SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
Extending and Scripting PDT
William Candillon {wcandillon@elv.telecom-lille1.eu}

          PHP London meeting, June 2009
Who am I ?

• Engineering student at Telecom Lille 1
• ETH Zurich: XQuery runtime in C++
• Aspect PHP Development Toolkit:
  http://apdt.googlecode.com
Who are you ?
• What is your favorite IDE?
 • VIM?
 • Netbeans?
 • Komodo?
 • PHPEd?
 • PDT / Zend Studio?
The Long Tail
Support


    PHP
      XDebug

          PEAR                 How to scale?
           PHP Unit
             Zend framework

                 frameworks
                          Business libraries
                                               test/build systems
                                                                    Development rules


   General                                                                 Specific
Eclipse galaxy
                Frameworks                                          Languages and modeling
                                   ECF
                                              GEF
                                                         OCL
                                 ALF                                EMF
                                              DTK
                     WTP                                UML
                                                                    GMF
          DTP
                           PDE
               MTJ          RCP
                                             Eclipse
                                                              EPF    SVN
                     J2EE
Applications
                                       JDT                     MAVEN
                                                       TPTP
                                               CDT                   ANT
                                 PDT                      MYLYN            Development tasks
                Programming                    RDT
                                  AJDT
                languages
                                         APDT

                     Plug-ins ecosystem (+ 1000)
Architecture
                                                     Un autre
               Eclipse Platform            Help       Outil


    Java           Workbench
Development
   Tools                   JFace
   (JDT)                                   Team

                   SWT
                                                      Votre
                                                      Outil
                                           Debug
  Plug-in
                   Workspace
Development
Environment
   (PDE)
                                            Update


                                                      Notre
                          Equinox (OSGI)              Outil

                                   JVM
PHP Development Toolkit


•   Developped by Zend and IBM since 2006

•   December 2008: version 2.0

•   Second most popular project on eclipse.org

•   100% under the EPL (Eclipse Public License)

•   Build on top of DLTK (Dynamic Language Toolkit)
Objectives


•   De-facto standard for PHP developments

•   Providing extension points and APIs to support
    PHP tools...

•   ...from the last hot PHP framework to the best
    practices of your company!
Architecture
Why extending ?

•   Integrate your own extension or framework

•   DLTK/PDT define more than 30 extension points!
What is extensible ? (1/3)


                       Launcher


                     Syntax highlighting
Explorer tree




                        Builder
  Outline
What is extensible ? (2/3)




Wizard pages
What is extensible ? (3/3)
                    Search semantic
Code refactoring
•   Abstract model of a PHP program

•   AST representation of source code

•   Tree walking and manipulation

•   Extensible type inference engine
What’s wrong ?
Use case


•   Objective: ensuring a simple development rule

•   Never trust your inputs!

•   Finding and fixing the bug...

•   ...in the coolest manner
Step 1
•   Strategy: extending PDT building process with our
    own build participant

•   Registering the contribution
Step 2
•   Build participant factory
    public class BuildParticipantFactory implements IBuildParticipantFactory {
      public IBuildParticipant createBuildParticipant(IScriptProject project){
        return new XSSProtectionParticipant();
      }
    }



•   Build participant
    public void build(IBuildContext context) throws CoreException{
      ISourceModule sourceModule = context.getSourceModule();
      ModuleDeclaration moduleDeclaration =
    SourceParserUtil.getModuleDeclaration(sourceModule);  Traverse the PHP AST
      try {
        moduleDeclaration.traverse(new XSSValidationVisitor(context));
      } catch (Exception e) {
        throw new CoreException(new Status(IStatus.ERROR, ExamplePlugin.PLUGIN_ID, quot;An error
    has occurred while invoking XSS validatorquot;, e));
      }
    }
Step 3
                                                                                      Module
                                                                                     Declaration
•   Trasverse the AST
                                                                                          ........
•   If the node is safe, don’t visit child nodes
    public boolean visit(PHPCallExpression node) throws Exception {
      if (node.getReceiver() == null) { // if this is a function call, not method
        String funcName = node.getName();
        if (quot;issetquot;.equalsIgnoreCase(funcName)) {
                                                                                         Call
        }
          return false;                                                               Expression
        return false;
      }

                                                                                          ........
•   Check variable references of globals
    protected boolean isURLParemeterVariable(VariableReference s) {
      String name = s.getName();
      return (quot;$_GETquot;.equals(name) || quot;$_POSTquot;.equals(name));                          Variable
    }
                                                                                      Reference
    public boolean visit(ArrayVariableReference s) throws Exception {
      if(isURLParemeterVariable(s)) {
        context.getProblemReporter().reportProblem(new DefaultProblem(context.getFile().getName(),
           quot;Unsafe use of quot; + s.getName() + quot;: possible XSS attackquot;,
    XSSProblem.UNSAFE_GLOBAL_REFERENCE.ordinal(),
           new String[0], ProblemSeverities.Error, s.sourceStart(), s.sourceEnd(),
           context.getLineTracker().getLineNumberOfOffset(s.sourceStart()))
        );
Result
•   Invalid PHP project

•   Mission accomplished!
Let’s digg it
•   PHP Quick Fix




•   Quick Fix proposal interface
    public interface IQuickFixProcessor
    {
      boolean hasCorrections(ISourceModule, int problemId);
      IScriptCompletionProposal[] getCorrections(IInvocationContext, IProblemLocation[]);
    }
Result




•   hasCorrection() checks if correction are availables

•   getCorrection() returns a collection of corrections

•   apply(document), performs the AST rewriting
Programming is hard...
•   ...Go scripting!

•   PHP Developpers need to extend Eclipse

    •   Without getting close to Java

    •   In a dynamic manner

•   Eclipse e4, the next generation of Eclipse

    •   Provides support for JavaScript bundles

    •   Dynamic execution and deployment model

•   Usage: Task automation, glue between plugins,
    scripting workflows, etc.
The recipie
•   Extension Registry




•   JavaScript source and Java bridge
    function helloworld() {
      var object = {
        run: function (action){
            Packages.org.eclipse.jface.dialogs.MessageDialog.openInformation(
            this.window.getShell(),
           'TestJavascriptPlugin', 'Hello, Eclipse world');
        },
        dispose: function(){},
        init: function(window) { this.window = window },
        selectionChanged: function(action, selection){}
        };
        return new JavaAdapter(Packages.org.eclipse.ui.IWorkbenchWindowActionDelegate, o);
    }
Dynamic deployment
•   JavaScript Plug-in Development Environment
    (http://jspde.googlecode.com)

•   Support JavaScript Plugins




•   Dynamic deployment
Conclusion
•   Extension mechanisms to integrate:

    •   PHP frameworks and tools

    •   Development workflows

•   PHP 5.3 support

•   Towards customized PDT distribution

•   Writing PHP plugins with PHP ?
Resources

• PDT website
• Extending and Scripting PDT tutorial
• Eclipse e4, JavaScript support
• PDT adopter’s
  • Aspect PHP Development Toolkit
  • Smarty
Thank you

Contenu connexe

Tendances

Eclipse Code Recommenders @ cross-event Deutsche Telekom Developer Garden Tec...
Eclipse Code Recommenders @ cross-event Deutsche Telekom Developer Garden Tec...Eclipse Code Recommenders @ cross-event Deutsche Telekom Developer Garden Tec...
Eclipse Code Recommenders @ cross-event Deutsche Telekom Developer Garden Tec...Marcel Bruch
 
Eclipse Code Recommenders @ MAJUG 2011
Eclipse Code Recommenders @ MAJUG 2011Eclipse Code Recommenders @ MAJUG 2011
Eclipse Code Recommenders @ MAJUG 2011Marcel Bruch
 
Java Exception Handling, Assertions and Logging
Java Exception Handling, Assertions and LoggingJava Exception Handling, Assertions and Logging
Java Exception Handling, Assertions and LoggingRiccardo Cardin
 
Java - Concurrent programming - Thread's advanced concepts
Java - Concurrent programming - Thread's advanced conceptsJava - Concurrent programming - Thread's advanced concepts
Java - Concurrent programming - Thread's advanced conceptsRiccardo Cardin
 
A (too) Short Introduction to Scala
A (too) Short Introduction to ScalaA (too) Short Introduction to Scala
A (too) Short Introduction to ScalaRiccardo Cardin
 
What's Expected in Java 7
What's Expected in Java 7What's Expected in Java 7
What's Expected in Java 7Gal Marder
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
Java- Concurrent programming - Synchronization (part 1)
Java- Concurrent programming - Synchronization (part 1)Java- Concurrent programming - Synchronization (part 1)
Java- Concurrent programming - Synchronization (part 1)Riccardo Cardin
 
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13Coen De Roover
 
DWX 2013 Nuremberg
DWX 2013 NurembergDWX 2013 Nuremberg
DWX 2013 NurembergMarcel Bruch
 
Recording Finer-Grained Software Evolution with IDE: An Annotation-Based Appr...
Recording Finer-Grained Software Evolution with IDE: An Annotation-Based Appr...Recording Finer-Grained Software Evolution with IDE: An Annotation-Based Appr...
Recording Finer-Grained Software Evolution with IDE: An Annotation-Based Appr...Shinpei Hayashi
 
Java - Generic programming
Java - Generic programmingJava - Generic programming
Java - Generic programmingRiccardo Cardin
 
An Introduction to SPL, the Standard PHP Library
An Introduction to SPL, the Standard PHP LibraryAn Introduction to SPL, the Standard PHP Library
An Introduction to SPL, the Standard PHP LibraryRobin Fernandes
 
Java- Concurrent programming - Synchronization (part 2)
Java- Concurrent programming - Synchronization (part 2)Java- Concurrent programming - Synchronization (part 2)
Java- Concurrent programming - Synchronization (part 2)Riccardo Cardin
 
2010 06-24 karlsruher entwicklertag
2010 06-24 karlsruher entwicklertag2010 06-24 karlsruher entwicklertag
2010 06-24 karlsruher entwicklertagMarcel Bruch
 
Java - Remote method invocation
Java - Remote method invocationJava - Remote method invocation
Java - Remote method invocationRiccardo Cardin
 
Java - Concurrent programming - Thread's basics
Java - Concurrent programming - Thread's basicsJava - Concurrent programming - Thread's basics
Java - Concurrent programming - Thread's basicsRiccardo Cardin
 
Eclipse Indigo DemoCamp Walldorf 2011
Eclipse Indigo DemoCamp Walldorf 2011Eclipse Indigo DemoCamp Walldorf 2011
Eclipse Indigo DemoCamp Walldorf 2011Marcel Bruch
 

Tendances (20)

Eclipse Code Recommenders @ cross-event Deutsche Telekom Developer Garden Tec...
Eclipse Code Recommenders @ cross-event Deutsche Telekom Developer Garden Tec...Eclipse Code Recommenders @ cross-event Deutsche Telekom Developer Garden Tec...
Eclipse Code Recommenders @ cross-event Deutsche Telekom Developer Garden Tec...
 
Eclipse Code Recommenders @ MAJUG 2011
Eclipse Code Recommenders @ MAJUG 2011Eclipse Code Recommenders @ MAJUG 2011
Eclipse Code Recommenders @ MAJUG 2011
 
Java Exception Handling, Assertions and Logging
Java Exception Handling, Assertions and LoggingJava Exception Handling, Assertions and Logging
Java Exception Handling, Assertions and Logging
 
Java - Concurrent programming - Thread's advanced concepts
Java - Concurrent programming - Thread's advanced conceptsJava - Concurrent programming - Thread's advanced concepts
Java - Concurrent programming - Thread's advanced concepts
 
A (too) Short Introduction to Scala
A (too) Short Introduction to ScalaA (too) Short Introduction to Scala
A (too) Short Introduction to Scala
 
Syntutic
SyntuticSyntutic
Syntutic
 
What's Expected in Java 7
What's Expected in Java 7What's Expected in Java 7
What's Expected in Java 7
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
Java- Concurrent programming - Synchronization (part 1)
Java- Concurrent programming - Synchronization (part 1)Java- Concurrent programming - Synchronization (part 1)
Java- Concurrent programming - Synchronization (part 1)
 
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
 
DWX 2013 Nuremberg
DWX 2013 NurembergDWX 2013 Nuremberg
DWX 2013 Nuremberg
 
Recording Finer-Grained Software Evolution with IDE: An Annotation-Based Appr...
Recording Finer-Grained Software Evolution with IDE: An Annotation-Based Appr...Recording Finer-Grained Software Evolution with IDE: An Annotation-Based Appr...
Recording Finer-Grained Software Evolution with IDE: An Annotation-Based Appr...
 
Java - Generic programming
Java - Generic programmingJava - Generic programming
Java - Generic programming
 
An Introduction to SPL, the Standard PHP Library
An Introduction to SPL, the Standard PHP LibraryAn Introduction to SPL, the Standard PHP Library
An Introduction to SPL, the Standard PHP Library
 
Java- Concurrent programming - Synchronization (part 2)
Java- Concurrent programming - Synchronization (part 2)Java- Concurrent programming - Synchronization (part 2)
Java- Concurrent programming - Synchronization (part 2)
 
GCC RTL and Machine Description
GCC RTL and Machine DescriptionGCC RTL and Machine Description
GCC RTL and Machine Description
 
2010 06-24 karlsruher entwicklertag
2010 06-24 karlsruher entwicklertag2010 06-24 karlsruher entwicklertag
2010 06-24 karlsruher entwicklertag
 
Java - Remote method invocation
Java - Remote method invocationJava - Remote method invocation
Java - Remote method invocation
 
Java - Concurrent programming - Thread's basics
Java - Concurrent programming - Thread's basicsJava - Concurrent programming - Thread's basics
Java - Concurrent programming - Thread's basics
 
Eclipse Indigo DemoCamp Walldorf 2011
Eclipse Indigo DemoCamp Walldorf 2011Eclipse Indigo DemoCamp Walldorf 2011
Eclipse Indigo DemoCamp Walldorf 2011
 

En vedette

Marketing On Line para la obtención de Resultados. 11 puntos a tener en cuenta
Marketing On Line para la obtención de Resultados. 11 puntos a tener en cuentaMarketing On Line para la obtención de Resultados. 11 puntos a tener en cuenta
Marketing On Line para la obtención de Resultados. 11 puntos a tener en cuentaGuillermo Vilarroig
 
Performance and Creativity
Performance and CreativityPerformance and Creativity
Performance and CreativityPhillip Jeffrey
 
The Tao of Sharing: Social Media, Games, Photography
The Tao of Sharing: Social Media, Games, PhotographyThe Tao of Sharing: Social Media, Games, Photography
The Tao of Sharing: Social Media, Games, PhotographyPhillip Jeffrey
 
The Role of Facebook in Everyday Student Life
The Role of Facebook in Everyday Student LifeThe Role of Facebook in Everyday Student Life
The Role of Facebook in Everyday Student LifePhillip Jeffrey
 
Thinking The Unthinkable: Introduction
Thinking The Unthinkable: IntroductionThinking The Unthinkable: Introduction
Thinking The Unthinkable: Introductionlisbk
 
Amplified Events, Seminars, Conferences, ...: What? Why? How?
Amplified Events, Seminars, Conferences, ...: What? Why? How?Amplified Events, Seminars, Conferences, ...: What? Why? How?
Amplified Events, Seminars, Conferences, ...: What? Why? How?lisbk
 
GP3 Piano Pedagogy Presentation- Transitioning from Student to Teacher in the...
GP3 Piano Pedagogy Presentation- Transitioning from Student to Teacher in the...GP3 Piano Pedagogy Presentation- Transitioning from Student to Teacher in the...
GP3 Piano Pedagogy Presentation- Transitioning from Student to Teacher in the...Melissa Slawsky
 
7 pragmatic initiatives to improve your CX in 2017
7 pragmatic initiatives to improve your CX in  20177 pragmatic initiatives to improve your CX in  2017
7 pragmatic initiatives to improve your CX in 2017Stefan Kolle
 
Xu hướng cửa hàng pop-up trong marketing ngành bán lẻ
Xu hướng cửa hàng pop-up trong marketing ngành bán lẻXu hướng cửa hàng pop-up trong marketing ngành bán lẻ
Xu hướng cửa hàng pop-up trong marketing ngành bán lẻPhi Van Nguyen
 
Scalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDBScalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDBWilliam Candillon
 
10 things to make you think
10 things to make you think10 things to make you think
10 things to make you thinkStefan Kolle
 

En vedette (16)

Marketing On Line para la obtención de Resultados. 11 puntos a tener en cuenta
Marketing On Line para la obtención de Resultados. 11 puntos a tener en cuentaMarketing On Line para la obtención de Resultados. 11 puntos a tener en cuenta
Marketing On Line para la obtención de Resultados. 11 puntos a tener en cuenta
 
Performance and Creativity
Performance and CreativityPerformance and Creativity
Performance and Creativity
 
XQuery Rocks
XQuery RocksXQuery Rocks
XQuery Rocks
 
My Summer of Code
My Summer of CodeMy Summer of Code
My Summer of Code
 
Facebook
FacebookFacebook
Facebook
 
The Tao of Sharing: Social Media, Games, Photography
The Tao of Sharing: Social Media, Games, PhotographyThe Tao of Sharing: Social Media, Games, Photography
The Tao of Sharing: Social Media, Games, Photography
 
The Role of Facebook in Everyday Student Life
The Role of Facebook in Everyday Student LifeThe Role of Facebook in Everyday Student Life
The Role of Facebook in Everyday Student Life
 
Thinking The Unthinkable: Introduction
Thinking The Unthinkable: IntroductionThinking The Unthinkable: Introduction
Thinking The Unthinkable: Introduction
 
Amplified Events, Seminars, Conferences, ...: What? Why? How?
Amplified Events, Seminars, Conferences, ...: What? Why? How?Amplified Events, Seminars, Conferences, ...: What? Why? How?
Amplified Events, Seminars, Conferences, ...: What? Why? How?
 
Not your Grandma's XQuery
Not your Grandma's XQueryNot your Grandma's XQuery
Not your Grandma's XQuery
 
GP3 Piano Pedagogy Presentation- Transitioning from Student to Teacher in the...
GP3 Piano Pedagogy Presentation- Transitioning from Student to Teacher in the...GP3 Piano Pedagogy Presentation- Transitioning from Student to Teacher in the...
GP3 Piano Pedagogy Presentation- Transitioning from Student to Teacher in the...
 
7 pragmatic initiatives to improve your CX in 2017
7 pragmatic initiatives to improve your CX in  20177 pragmatic initiatives to improve your CX in  2017
7 pragmatic initiatives to improve your CX in 2017
 
Xu hướng cửa hàng pop-up trong marketing ngành bán lẻ
Xu hướng cửa hàng pop-up trong marketing ngành bán lẻXu hướng cửa hàng pop-up trong marketing ngành bán lẻ
Xu hướng cửa hàng pop-up trong marketing ngành bán lẻ
 
Scalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDBScalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDB
 
10 things to make you think
10 things to make you think10 things to make you think
10 things to make you think
 
Culture
CultureCulture
Culture
 

Similaire à Extending and scripting PDT

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
 
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
 
Java Applications with Visual Studio
Java Applications with Visual StudioJava Applications with Visual Studio
Java Applications with Visual StudioRed Hat Developers
 
Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Oliver Gierke
 
Eclipse Modeling Framework
Eclipse Modeling FrameworkEclipse Modeling Framework
Eclipse Modeling FrameworkAjay K
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav DukhinFwdays
 
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Paul King
 
Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RacePure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RaceBaruch Sadogursky
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.ILEran Harel
 
Whoops! where did my architecture go?
Whoops! where did my architecture go?Whoops! where did my architecture go?
Whoops! where did my architecture go?Oliver Gierke
 
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!Michał Ćmil
 
L Fu - Dao: a novel programming language for bioinformatics
L Fu - Dao: a novel programming language for bioinformaticsL Fu - Dao: a novel programming language for bioinformatics
L Fu - Dao: a novel programming language for bioinformaticsJan Aerts
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLsintelliyole
 
Extension and Evolution
Extension and EvolutionExtension and Evolution
Extension and EvolutionEelco Visser
 

Similaire à Extending and scripting PDT (20)

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
 
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.
 
Java Applications with Visual Studio
Java Applications with Visual StudioJava Applications with Visual Studio
Java Applications with Visual Studio
 
Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?
 
Eclipse Modeling Framework
Eclipse Modeling FrameworkEclipse Modeling Framework
Eclipse Modeling Framework
 
Java introduction
Java introductionJava introduction
Java introduction
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
 
NvFX GTC 2013
NvFX GTC 2013NvFX GTC 2013
NvFX GTC 2013
 
Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RacePure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools Race
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
Whoops! where did my architecture go?
Whoops! where did my architecture go?Whoops! where did my architecture go?
Whoops! where did my architecture go?
 
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
Eclipse RCP outside of Eclipse IDE - Gradle to the rescue!
 
L Fu - Dao: a novel programming language for bioinformatics
L Fu - Dao: a novel programming language for bioinformaticsL Fu - Dao: a novel programming language for bioinformatics
L Fu - Dao: a novel programming language for bioinformatics
 
1- java
1- java1- java
1- java
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Extension and Evolution
Extension and EvolutionExtension and Evolution
Extension and Evolution
 

Plus de William Candillon

Plus de William Candillon (6)

JSONiq - The SQL of NoSQL
JSONiq - The SQL of NoSQLJSONiq - The SQL of NoSQL
JSONiq - The SQL of NoSQL
 
Cutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQueryCutting Edge Data Processing with PHP & XQuery
Cutting Edge Data Processing with PHP & XQuery
 
XQuery Design Patterns
XQuery Design PatternsXQuery Design Patterns
XQuery Design Patterns
 
XREST Protocol
XREST ProtocolXREST Protocol
XREST Protocol
 
XQuery in the Cloud
XQuery in the CloudXQuery in the Cloud
XQuery in the Cloud
 
Aspect-Oriented Programming for PHP
Aspect-Oriented Programming for PHPAspect-Oriented Programming for PHP
Aspect-Oriented Programming for PHP
 

Dernier

Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 

Dernier (20)

Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 

Extending and scripting PDT

  • 1. Extending and Scripting PDT William Candillon {wcandillon@elv.telecom-lille1.eu} PHP London meeting, June 2009
  • 2. Who am I ? • Engineering student at Telecom Lille 1 • ETH Zurich: XQuery runtime in C++ • Aspect PHP Development Toolkit: http://apdt.googlecode.com
  • 3. Who are you ? • What is your favorite IDE? • VIM? • Netbeans? • Komodo? • PHPEd? • PDT / Zend Studio?
  • 4. The Long Tail Support PHP XDebug PEAR How to scale? PHP Unit Zend framework frameworks Business libraries test/build systems Development rules General Specific
  • 5. Eclipse galaxy Frameworks Languages and modeling ECF GEF OCL ALF EMF DTK WTP UML GMF DTP PDE MTJ RCP Eclipse EPF SVN J2EE Applications JDT MAVEN TPTP CDT ANT PDT MYLYN Development tasks Programming RDT AJDT languages APDT Plug-ins ecosystem (+ 1000)
  • 6. Architecture Un autre Eclipse Platform Help Outil Java Workbench Development Tools JFace (JDT) Team SWT Votre Outil Debug Plug-in Workspace Development Environment (PDE) Update Notre Equinox (OSGI) Outil JVM
  • 7. PHP Development Toolkit • Developped by Zend and IBM since 2006 • December 2008: version 2.0 • Second most popular project on eclipse.org • 100% under the EPL (Eclipse Public License) • Build on top of DLTK (Dynamic Language Toolkit)
  • 8. Objectives • De-facto standard for PHP developments • Providing extension points and APIs to support PHP tools... • ...from the last hot PHP framework to the best practices of your company!
  • 10. Why extending ? • Integrate your own extension or framework • DLTK/PDT define more than 30 extension points!
  • 11. What is extensible ? (1/3) Launcher Syntax highlighting Explorer tree Builder Outline
  • 12. What is extensible ? (2/3) Wizard pages
  • 13. What is extensible ? (3/3) Search semantic
  • 14. Code refactoring • Abstract model of a PHP program • AST representation of source code • Tree walking and manipulation • Extensible type inference engine
  • 16. Use case • Objective: ensuring a simple development rule • Never trust your inputs! • Finding and fixing the bug... • ...in the coolest manner
  • 17. Step 1 • Strategy: extending PDT building process with our own build participant • Registering the contribution
  • 18. Step 2 • Build participant factory public class BuildParticipantFactory implements IBuildParticipantFactory { public IBuildParticipant createBuildParticipant(IScriptProject project){ return new XSSProtectionParticipant(); } } • Build participant public void build(IBuildContext context) throws CoreException{ ISourceModule sourceModule = context.getSourceModule(); ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(sourceModule); Traverse the PHP AST try { moduleDeclaration.traverse(new XSSValidationVisitor(context)); } catch (Exception e) { throw new CoreException(new Status(IStatus.ERROR, ExamplePlugin.PLUGIN_ID, quot;An error has occurred while invoking XSS validatorquot;, e)); } }
  • 19. Step 3 Module Declaration • Trasverse the AST ........ • If the node is safe, don’t visit child nodes public boolean visit(PHPCallExpression node) throws Exception { if (node.getReceiver() == null) { // if this is a function call, not method String funcName = node.getName(); if (quot;issetquot;.equalsIgnoreCase(funcName)) { Call } return false; Expression return false; } ........ • Check variable references of globals protected boolean isURLParemeterVariable(VariableReference s) { String name = s.getName(); return (quot;$_GETquot;.equals(name) || quot;$_POSTquot;.equals(name)); Variable } Reference public boolean visit(ArrayVariableReference s) throws Exception { if(isURLParemeterVariable(s)) { context.getProblemReporter().reportProblem(new DefaultProblem(context.getFile().getName(), quot;Unsafe use of quot; + s.getName() + quot;: possible XSS attackquot;, XSSProblem.UNSAFE_GLOBAL_REFERENCE.ordinal(), new String[0], ProblemSeverities.Error, s.sourceStart(), s.sourceEnd(), context.getLineTracker().getLineNumberOfOffset(s.sourceStart())) );
  • 20. Result • Invalid PHP project • Mission accomplished!
  • 21. Let’s digg it • PHP Quick Fix • Quick Fix proposal interface public interface IQuickFixProcessor { boolean hasCorrections(ISourceModule, int problemId); IScriptCompletionProposal[] getCorrections(IInvocationContext, IProblemLocation[]); }
  • 22. Result • hasCorrection() checks if correction are availables • getCorrection() returns a collection of corrections • apply(document), performs the AST rewriting
  • 23. Programming is hard... • ...Go scripting! • PHP Developpers need to extend Eclipse • Without getting close to Java • In a dynamic manner • Eclipse e4, the next generation of Eclipse • Provides support for JavaScript bundles • Dynamic execution and deployment model • Usage: Task automation, glue between plugins, scripting workflows, etc.
  • 24. The recipie • Extension Registry • JavaScript source and Java bridge function helloworld() { var object = { run: function (action){ Packages.org.eclipse.jface.dialogs.MessageDialog.openInformation( this.window.getShell(), 'TestJavascriptPlugin', 'Hello, Eclipse world'); }, dispose: function(){}, init: function(window) { this.window = window }, selectionChanged: function(action, selection){} }; return new JavaAdapter(Packages.org.eclipse.ui.IWorkbenchWindowActionDelegate, o); }
  • 25. Dynamic deployment • JavaScript Plug-in Development Environment (http://jspde.googlecode.com) • Support JavaScript Plugins • Dynamic deployment
  • 26. Conclusion • Extension mechanisms to integrate: • PHP frameworks and tools • Development workflows • PHP 5.3 support • Towards customized PDT distribution • Writing PHP plugins with PHP ?
  • 27. Resources • PDT website • Extending and Scripting PDT tutorial • Eclipse e4, JavaScript support • PDT adopter’s • Aspect PHP Development Toolkit • Smarty