X

Best Practices from Oracle Development's A‑Team

A Simple Utility Program for Modifying PCS Application Reference Properties

Introduction

As part of the development, test, and deployment process, PCS customers often need to move PCS applications from one environment to another. Currently (as of version 17.2.3) this is a manual process. Customers have to export applications from a source PCS environment, make necessary changes in connectors and then import the applications to a target environment. There are no PCS APIs available for exporting and importing. So these two steps have to be done manually. It can be tedious work when there is a number of PCS applications to move. But it is less error-prone than the middle step where you have to modify a large number of connector configurations. A typical example of such configuration changes is modifying URL end points of external web service and REST service providers.

This post presents a simple utility program that automates the process of modifying connector configurations.

What does this utility program do?

1. Load a property file

The default property file name is pcs-util.properties. This property file specifies the following properties:

SourceDirectory=./pcs-apps : a source directory that contains all PCS applications (.exp files) exported from a source environment
TempDirectory=./pcs-apps/temp : a temporary directory that contains unzipped PCS applications
DestinationDirectory=./pcs-apps/output : an output directory that contains a change log file and modified PCS applications
NewUrlLocationsFileName=./pcs-apps/newlocations.properties : a property file that specifies new property values we want to change to

2. Load new property values from newlocations.properties

A sample newlocations.properties file contains the following properties:

TestWebformApp.SimpleRestServiceConnector.location=http://localhost:9001/simplerestweb/resources

Specifies a new location attribute value for SimpleRestServiceConnector in the TestWebformApp PCS application.

TestWebformApp.SimpleRestServiceConnector.timeout=27000

Specifies a new connection and read timeout value for SimpleRestServiceConnector in the TestWebformApp PCS application.

Notice the property name composition is appName.connectorName.attributeName.

3. Get alll PCS application file names in the source directory and process each PCS application as the following steps

4. Unzip a PCS application to the temp directory

5. Parse the composite.xml file using DOM

6. Find element reference/binding.rest

7. Replace the location attribute value with a new value if exists

8. Add or replace connection timeout value if a new value exists

In version 17.2.3, the REST Connector default connection and read timeout values are set to 5 seconds. This property is not yet exposed in the PCS user interface for modification. To change this timeout value, we have to manually add the following two lines to the composite.xml file.

<binding.rest config="WADLs/SimpleRestServiceConnector.wadl" location="http://localhost:8001/simplerestweb/resources">
    <property many="false" name="http.readTimeout">16000</property>
    <property many="false" name="http.connTimeout">16000</property>
</binding.rest>

9. Save the composite.xml

10. Zip the modified PCS application to an output directory

11. Write change log file

 

To run the utility program

Set JAVA_HOME in run.cmd and simply type run.cmd in a Windows command window.

They have tested against PCS version 17.2.3.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha