Renaming BPEL Process Names

A common problem is that developers don't get the BPEL process name right the first time. There have been a number of solutions proposed on the Internet which range from 'you just can't do it' to complicated Linux 'one-liners' which don't work on Windows.

Wouldn't it be nice to just have a "Rename BPEL Process" button in JDeveloper for SOA Suite 11g.

What we need is a script which will do the following:

  1. Run on any platform that JDeveloper supports (ie, Windows, Linux, and Mac).
  2. Rename the old filename to the new filename of the BPEL process.
  3. Updated any string references to the old BPEL name with the new BPEL name in any file that references the BPEL process.
  4. Easily accessible from JDeveloper (ie, no complicated command line wizardry).

JDeveloper has an option to call an "External Tool" which can also be a custom Ant script. This "External Tool" can be called from the toolbar of JDeveloper, including the context menu of the Application Navigator View.

Here is a build.xml Ant script which takes care of the above requirements.

<?xml version="1.0" encoding="UTF-8" ?>
<project default="RenameBPELProcessInJDeveloper11gR1">
    <target name="RenameBPEL">
        <echo>Workdir: ${PROJECT_DIR}</echo>
        <echo>String replacement: ${FILENAME_NO_EXT} -> ${NEW_FILENAME}</echo>
        <replace dir="${PROJECT_DIR}" token="${FILENAME_NO_EXT}" value="${NEW_FILENAME}">
            <exclude name="**/.svn*"/>
        </replace>
        <echo>complete...</echo>
        <echo>Renaming ${FILENAME_NO_EXT} -> ${NEW_FILENAME} in ${PROJECT_DIR}</echo>
        <move todir="${PROJECT_DIR}">
            <fileset dir="${PROJECT_DIR}">
                <exclude name=".svn*"/>
            </fileset>
            <mapper type="glob" from="${FILENAME_NO_EXT}*" to="${NEW_FILENAME}*"/>
        </move>
        <echo>Renaming ${FILENAME_NO_EXT} -> ${NEW_FILENAME} in ${PROJECT_DIR}/xsd</echo>
        <move todir="${PROJECT_DIR}/xsd">
            <fileset dir="${PROJECT_DIR}/xsd">
                <exclude name=".svn*"/>
            </fileset>
            <mapper type="glob" from="${FILENAME_NO_EXT}*" to="${NEW_FILENAME}*"/>
        </move>
        <echo>Renaming ${FILENAME_NO_EXT} -> ${NEW_FILENAME} in ${PROJECT_DIR}/xsl</echo>
        <move todir="${PROJECT_DIR}/xsl">
            <fileset dir="${PROJECT_DIR}/xsd">
                <exclude name=".svn*"/>
            </fileset>
            <mapper type="glob" from="${FILENAME_NO_EXT}*" to="${NEW_FILENAME}*"/>
        </move>
        <echo>complete...</echo>
     </target>
</project>

Save this script to a file called build.xml and store it in a folder called RenameBPELAntScript.

We will also need an icon for the "External Tool" button in the JDeveloper Toolbar. For example this one: 
Right-click and "Save Image As...". 

Next follow these steps:

  1. Tools -> External Tools...
  2. New
  3. Tool Type: Apache Ant
  4. Ant Build File: (Browse to build.xml file)
  5. Move RenameBPEL target from Available Targets to Selected Targets.
  6. Add Property -> Insert -> File Directory | Property Name: PROJECT_DIR
  7. Add Property -> Insert -> File Name Without Extension | Property Name: FILENAME_NO_EXT
  8. Add Property -> Insert -> Prompt | Property Name: NEW_FILENAME
  9. Options Page, no changes required. Click Next.
  10. Process Page, no changes required. Click Next.
  11. Classpath Page, no changes required. Click Next.
  12. Display Page: 
    Caption for Menu Items: Rename BPEL Process
    Icon Location: (Browse to renameBpelIcon.gif)
    Click Next.
  13. Integration Page:
    Add Items to Menus: 
    Tools Menu
    Navigator Context Menu
    Add Buttons to Toolbars:
    Main Toolbar
    Before Tool Starts:
    Save All
    After Tool Exits:
    Reload Open File:
    Log Output to Messages Log
    Click Next
  14. Availability Page:
    Select: When Specific File Types are Selected
    Move BPEL Process from Available Types to Selected Types
  15. Click Finish
  16. Click OK

So what does the result look like?

Select a BPEL process in the Application Navigator of JDeveloper. Now you have two options for invoking the Rename BPEL process 'External Tool'.

As shown below, you can press the new icon in the toolbar. 

Alternatively you can select from the context menu. 

The complete process should look something like this: 

Notice that the original filename was foo.bpel and we have renamed it to bar.bpel.

If you are using Oracle Suite for 11g, then the above solution will solve your BPEL process rename issue. This same features is already on the roadmap for 12c.

Comments:

This is really interesting. Will this utility work for BPM processes as well? This is a major issue we have with BPM processes too.

Posted by guest on May 21, 2012 at 12:19 PM GMT+13:00 #

Hey there.

All the build.xml Ant script does is just string manipulation on a bunch of files inside JDeveloper. As long as your processes are written in JDeveloper, this process will work.

I haven't tried this with BPM yet.

Regards, Sebastian.

Posted by guest on May 21, 2012 at 12:32 PM GMT+13:00 #

Worked like a charm! Thanks so much for posting this article!

Posted by guest on May 25, 2012 at 09:02 AM GMT+13:00 #

Excellent work...

Posted by guest on June 20, 2012 at 12:26 AM GMT+13:00 #

It is Excellent ... Very much useful for the new developers.

Posted by guest on August 26, 2012 at 02:08 AM GMT+13:00 #

Really helpful.... thanks for the effort

Posted by Rijesh on August 28, 2012 at 06:35 PM GMT+13:00 #

A typo/ change is needed in build.xml, see below
but it works neatly!

<echo>Renaming ${FILENAME_NO_EXT} -> ${NEW_FILENAME} in ${PROJECT_DIR}/xsl</echo>
<move todir="${PROJECT_DIR}/xsl">
<fileset dir="${PROJECT_DIR}/xsd">

..last line needs to read

<fileset dir="${PROJECT_DIR}/xsl">

Posted by guest on October 12, 2012 at 10:04 PM GMT+13:00 #

Works great!. This tool was helpful in increasing productivity when we have similar projects to be recreated from base template BPEL.

Posted by Vinay on November 20, 2012 at 08:26 AM GMT+13:00 #

Excellent blog. One small recommendation
if you didnt specify the name of the file, it makes it empty. To Avoid that
put this line right after Target
<fail unless="${NEW_FILENAME}">File Name must be set</fail>

Thanks a lot sebastian

Posted by guest on November 28, 2012 at 01:23 PM GMT+13:00 #

It works great! But this external tool keeps exiting when i close the jdeveloper. I have to redo this all the time whenever i open jdeveloper?

Posted by guest on October 11, 2013 at 06:16 AM GMT+13:00 #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Discussions and Examples using Oracle Fusion Middleware. Some image links are broken when using Firefox, Safari, and Chrome. If you want to see the full image please use IE.

Twitter:@james8001

tumblr hit counter vistors, thanks for your support

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today