2011-06-04

The easiest way to refactor a BPEL process with BPEL Process Manager

 

Lately, I’ve been pretty extensively using BPEL Process Manager to migrate my client WLI projects towards the new official Oracle preferred product.

I could have used the official migration tool, which has been developed (I should say extended, since this feature is not exactly new), but as I explained it to several clients,

I prefer to code my application from scratch, since it would allow me to really use the product.

I heard that some projects which went the “migration tool” road, did an amazing job at automating the migration by tuning the tool and adding some post-processing scripts.

But such a method is annoying about one point : you do not improve the knowledge of the new tool, which is important when you have to do some maintenance on projects relying on it.

Then I started to work with BPEL PM and I quickly find myself with lots of files (BPEL file, Mediators, WSDL & _property WSDL for each and every new BPEL Process) and I felt like cleaning up my playground.

I decided to create some directories and to put my BPEL processes (and their associated files) in them. Coming from Eclipse like lots of developers, I was expecting the refactor option to be in a contextual menu, but it was not that easy to find … indeed, it’s only accessible in a top menu :

 

image

 

After a quick while, my process was moved. I tried to compile and I got an error message, saying the BPEL process was nowhere to be found, while validating the composite ….

Huh ? I then looked into the composite and … here was the object of my compiler complaint : the path of the BPEL process has not been updated !

I decided to file a case to the Oracle Support and I won’t make any comment about the answer I was given. If you have an Oracle Support account, see for yourself, it’s the following case number : SR 3-3082902481: JDev can't handle a proper BPEL refactor.

What I can tell you is that the answer was far from being satisfying.

Then, I had to find a way to order my stuff, and to be more productive than editing all the files one by one, to make sure the references were correctly changed.

I searched a bit and I started to find some Unix commands that sounded promising.

And finally, I came to those lines who helped me A LOT !

Those lines perform a rename ON the file itself. I was forced to use different cases because that’s the way BPEL PM does it.

find . -type f | egrep '.bpel$|.wsdl$|.mplan$|.componentType$|.xml$' | xargs rename Process1 Process2 *.*
find . -type f | egrep '.bpel$|.wsdl$|.mplan$|.componentType$|.xml$' | xargs rename process1 process2 *.*

The following lines perform a rename IN the found file(s).

find . -type f | egrep '.bpel$|.wsdl$|.mplan$|.componentType$|.xml$' | xargs sed -i 's/Process1/Process2/g'
find . -type f | egrep '.bpel$|.wsdl$|.mplan$|.componentType$|.xml$' | xargs sed -i 's/process1/process2/g'

 

Using those two commands, it will help you save up some time. At least, it did for me ! :)

1 comment:

Aanchal said...

Hi,
I have been trying to migrate a sample WLI application to SOA suite (BPEL) but facing issues.
I read somewhere that there is a "WLI to SOA Suite migration tool" optimized for Oracle JDeveloper 11g and SOA Suite 11g.
Can you please tell me something about this tool?
Thanks in advance!