How to boost your (BPEL) development team ?

Working in an agile context, customer ask me to find a solution to speed up their BPEL development process. The development team are quite experimented in Java and relatively new to BPEL development. As the development team grow, some BPEL process patterns have been implemented and tested successfully. Management ask the team to be more productive as new BPEL process should be based on existing’s implementation.

It tooks at last 2-3 week for the team to implemented a BPEL process, if you start from scratch, implementing your BPEL process from the beginning to end, including unit and integration testing. Working with developers show me that often :
– it takes time to instantiate a new BPEL process, as refactoring BPEL project in JDevelopper is not perfect as it should be
– it take time to replicate the pattern, as they should build a project from scratch
– they use copy and paste on some BPEL snipplet code (with the impact of wrong namespace prefix, inherent to BPEL)

A possible path to speed up this development process is described below, thanks to Maven and it’s archetype plugin (This can be applied to any language and technology).

Maven_Archetype

One car argue, that Oracle SOA Suite/JDevelopper provide a way to do this, using customization role, but i find it personally hard to use, with a lot of limitation when this should be applied to a big project. And switching between profile (Default / Customization Developer role) in JDEvelopper is painfull, and not natural.

The complexity with BPEL code is link to the different file managed by JDevelopper, as it ‘s a WYSIWYG ‘s tools. As a matter of fact, when you wire a link in JDevelopper, somes files are modified underneath, and you must understand the relationship between thoses generated files in order to create an maven archetype.
For exemple, here a the type of file managed by JDevelopper:

  • .jws,.jpr to handle SOA Application and composite project
  • .componentType, .bpel, .xml, .xsd to handle bpel code
  • .xsd, .wsdl to handle interface contract
  • .xslt, .xq for transformation & mapping

    Step 1: if your refactoring product tools is not powerful enough, use bash script to handle this.
    Here are some sample script to rename files & folder
    rename.sh

    #!/bin/bash
    counter=0
    function replaceFile
    {		
            originalFile=`find $folderPath -type f -name  "*$pattern*" | sed -n '1p'`
            if [ ${#originalFile} -ne 0 ];
            then
                    #if [ -f $originalFile ];
                    #then
                    #        echo replacing $pattern to $replacePattern in $originalFile
                    #        sed -i "s/$pattern/$replacePattern/g" $originalFile
                    #fi
    				dirFile=`dirname $originalFile`
    				nameFile=`basename $originalFile`
    				destinationFile="${nameFile//$pattern/$replacePattern}"
                    echo moving $originalFile to $dirFile/$destinationFile
                    mv $originalFile $dirFile/$destinationFile
                    counter=$[$counter +1]
                    return 1
            fi
            return 0
    }
    
    function replaceFolder
    {		
            originalFile=`find $folderPath -type d -name  "*$pattern*" | sed -n '1p'`
            if [ ${#originalFile} -ne 0 ];
            then
                    #if [ -f $originalFile ];
                    #then
                    #        echo replacing $pattern to $replacePattern in $originalFile
                    #        sed -i "s/$pattern/$replacePattern/g" $originalFile
                    #fi		
    				dirFile=`dirname $originalFile`
    				nameFile=`basename $originalFile`		
                    destinationFolder="${originalFile//$pattern/$replacePattern}"                
    				echo $dirFile - $nameFile - $destinationFolder
    			    echo moving $dirFile/$nameFile to $destinationFolder
    			    mv $dirFile/$nameFile $destinationFolder
    			    counter=$[$counter +1]
    			    return 1				
            fi
            return 0
    }
    
    
    if [ $# -ne 3 ]
      then
        echo "Usage:  <Path to folder> <pattern> <replacePattern>"
      else
    	folderPath=$1
        pattern=
        replacePattern=
      
    	replaceFolder	
    	replaceFolder
    	
    	ret=1
    	until [ $ret -eq 0 ]
    	do
            replaceFile		
            ret=$?
    	done
    
    	echo "$counter file/(s/) replaced"
    fi  
    

    Here are some sample to sample script to replace content in à file based on regexp
    replace.sh

    #!/bin/bash
    
    counter=0
    function SedFile
    {		
            find $folderPath -type f | while read line
            do
    			echo "Processing file $line, replace $pattern with $replacePattern"
    			#http://stackoverflow.com/questions/10309968/sed-search-and-replace-strings-containing?rq=1
    			sed -i "s%$pattern%$replacePattern%g" $line
            done
    }
    
    if [ $# -ne 3 ]
      then
        echo "Usage:  <folderPath> <pattern> <replacePattern>"
      else
    	folderPath=$1
        pattern=
        replacePattern=
      	SedFile
    fi
    
    

    Use thoses scripts to clone your sample project to a template project.

    Step 2: Clean specificity of sample project in your clone project to make the clone project a real template.
    For example, in a BPEL project, I have to:

  • remove specific mapping in XSLT, XQuey, Assign
  • remove some BPEL scope that should not appears in template, and replace with empty TODO scope
  • remove some wire that should not be part of the mapping and so on …
  • At the end, we have a built a real useful template project (and of course compilable and modifiable project in JDeveloper). We have notice, that it really speed up the development process, as the template contains already 80% of a final project. The developper can then concentrate on completing the mapping & routing to finalize the BPEL process.

    Tips: if you use SpringContext or EJB components, you don’t need to have the JAR associated in your SCA-INF/lib. In fact, the wire has been cloned; and JDEveloper does not need thoses JAR in design-time (it must exist for runtime). Of course, if you need to recreate the wire, than JAR are also needed.

    Step 3: Use Maven to create an archetype from the template project

    mvn archetype:create-from-project -Darchetype.filteredExtentions=bpel,wsdl,xml,componentType,jca,jpr,xsl,xq -Darchetype.preserveCData=true -Darchetype.properties=templateXYZ.properties --settings C:\outils\apache-maven-3.0.5\conf\settings.xml
    

    Step 4: Use the following Maven command to update local catalog and/or generate the template project

    mvn archetype:update-local-catalog --settings C:\outils\apache-maven-3.0.5\conf\settings.xml
    mvn archetype:generate -DarchetypeCatalog=local
    

    Step 5: Use the following Maven command to update local catalog and/or generate the template project

    mvn archetype:update-local-catalog --settings C:\outils\apache-maven-3.0.5\conf\settings.xml
    mvn archetype:generate -DarchetypeCatalog=local
    
    Advertisements