The XL Deploy Oracle WebLogic (WLS) plugin is designed to be extended through XL Deploy’s plugin API type system and through the use of custom, user-defined WebLogic Scripting Tool (WLST) Python scripts.

The WebLogic plugin associates CREATE, MODIFY, and DESTROY operations received from XL Deploy with WLST Python scripts that need to be executed for the operation. The operation-specific script is given a Python object representation of the deployed that triggered the operation. The script is then executed on the target domain, using WLST.

Sample wls.Datasource definition and script

This is a sample definition of wls.Datasource in the synthetic.xml file:

<type type="wls.DataSource" extends="wls.Resource" deployable-type="wls.DataSourceSpec">
    <generate-deployable type="wls.DataSourceSpec" extends="wls.ResourceSpec" />

    <property name="additionalPropertiesNotToExpose" hidden="true" default="jndiNames, url, driverName, username, password, properties"/>

    <property name="createScript"  default="wls/ds/"  hidden="true" />
    <property name="destroyScript" default="wls/ds/" hidden="true" />

    <property name="jndiNames"/>
    <property name="url"/>
    <property name="driverName"/>
    <property name="username"/>
    <property name="password" password="true"/>

Tip: For information about the configuration items (CIs) included in the plugin, refer to the WebLogic plugin reference.

The script can use all information from the deployed to translate to the WLST API calls needed to configure WebLogic. The following sample Python snippet creates a datasource:

datasourcePath = '/JDBCSystemResources/%s/JDBCResource/%s' % (,
cd('%s/JDBCDriverParams/%s' % (datasourcePath,
set("Url", deployed.url)
set("DriverName", deployed.driverName)
set('Password', deployed.password)
# use jmsModuleName, jmsServer and jndiName to create the queue

Change the order of steps

The WebLogic plugin allows you to influence the order in which scripts are executed in relation to other deployed operations. The order allows you to chain scripts to create a logical sequence of events.

For example, the following synthetic.xml code indicates that the queue will be created (order = 60) before the EAR file is deployed (order = 70), and the queue will be destroyed (order = 40) after the EAR file is undeployed (order = 30).

<type type="wls.EarModule" extends="wls.ExtensibleDeployedArtifact" deployable-type="jee.Ear">
    <generate-deployable type="wls.Ear" extends="jee.Ear" />

    <property name="createScript" default="wls/application/" hidden="true"/>
    <property name="createVerb" default="Deploy" hidden="true" />
    <property name="createOrder" kind="integer" default="70" hidden="true" />

    <property name="destroyScript" default="wls/application/" hidden="true"/>
    <property name="destroyVerb" default="Undeploy" hidden="true" />
    <property name="destroyOrder" kind="integer" default="30" hidden="true" />

    <property name="startScript" default="wls/application/" hidden="true"/>
    <property name="startOrder" kind="integer" default="90" hidden="true" />

    <property name="stopScript" default="wls/application/" hidden="true"/>
    <property name="stopOrder" kind="integer" default="10" hidden="true" />

<type type="wls.Queue" extends="wls.AbstractQueue" deployable-type="wls.QueueSpec">
    <generate-deployable type="wls.QueueSpec" extends="wls.JmsResourceSpec"/>

    <property name="createScript" default="wls/jms/" hidden="true"/>
    <property name="createVerb" default="Create" hidden="true" />
    <property name="createOrder" kind="integer" default="60" hidden="true" />

    <property name="destroyScript" default="wls/jms/" hidden="true"/>
    <property name="destroyVerb" default="Destroy" hidden="true" />
    <property name="destroyOrder" kind="integer" default="40" hidden="true" />

    <property name="setErrorDestinationScript" default="wls/jms/" hidden="true"/>
    <property name="unsetErrorDestinationScript" default="wls/jms/" hidden="true"/>

Hide a property of a deployed or deployable

You can hide existing deployed and deployable properties in the XL Deploy user interface and give them default values. For example, the following synthetic.xml code shows how the JDBCConnectionPoolParams_CapacityIncrement property in wls.Datasource can be hidden and given a default value of 2.

<type-modification type="wls.DataSource">
    <!-- Makes the property hidden from the UI -->
    <property name="JDBCConnectionPoolParams_CapacityIncrement" category="Connection Pool" label="Capacity Increment" kind="integer" hidden="true" default="2"/>

Add a new property to a deployed or deployable

You can add new properties to deployeds and deployables. For example, the following synthetic.xml code shows how a new property called inactiveConnectionTimeoutSeconds can be added to wls.Datasource.

<type-modification type="wls.DataSource">
    <!-- Adding new property -->
    <property name="JDBCConnectionPoolParams_InactiveConnectionTimeoutSeconds"  category="Connection Pool" label="Inactive Connection Timeout (sec)" kind="integer" description="inactive Connection Timeout in Seconds" />

Important: When you add a new property in the WebLogic plugin, the property name should correspond to the relative path of the property (file) from the configuration item in WLST (without the type name). For example, because the relative path of property InactiveConnectionTimeoutSeconds in WLST is {datasource-name}/JDBCConnectionPoolParams/{datasource-name}/InactiveConnectionTimeoutSeconds, the property name to use is JDBCConnectionPoolParams_InactiveConnectionTimeoutSeconds.

Add a new CI type

You can add a new configuration item (CI) type to the WebLogic plugin. For example, the following synthetic.xml code shows the definition of a new CI type called wls.WorkManager. Because it is a resource and it can be targeted to a cluster or a server, it extends wls.Resource.

<type type="wls.WorkManager" extends="wls.Resource" deployable-type="wls.WorkManagerSpec">
    <generate-deployable type="wls.WorkManagerSpec" extends="wls.ResourceSpec"/>

    <property name="createScript"  default="wls/env/"  hidden="true" />
    <property name="destroyScript" default="wls/env/" hidden="true" />

The name property is automatically added to all CIs, so it has not been defined explicitly as a property. Additional properties can be added in the definition as needed.

Add Python scripts for steps

The next step involves adding Python scripts for steps. For the wls.WorkManager example, two Python scripts need to be created: and

Sample create script

This is a sample wls/env/ script:

workManagerPath='/SelfTuning/%s/WorkManagers/%s' %(,

if exists(workManagerPath):
    print 'Modifying work manager %s for target %s' % (,
    setOrOverride = overrideWithWarning
    print 'Creating work manager %s for target %s' % (,
    cd('/SelfTuning/' + + '/WorkManagers')
    setOrOverride = set

newTargets = []
for t in get('Targets'):

set('Targets', jarray.array(newTargets, ObjectName))


Sample destroy script

This is a sample wls/env/ script:

workManagerPath='/SelfTuning/%s/WorkManagers/%s' %(,

if not exists(workManagerPath):
    print "Work manager with name %s does not exist." %(

currentTargets = get('Targets')
print 'oldTargets: %s' %(currentTargets)
containerTarget = ObjectName(deployed.container.objectName)
newTargets = []
for t in currentTargets:
    if t != containerTarget:

print 'new targets: %s' %(newTargets)
if len(newTargets) > 0:
    print 'Modifying work manager %s' %(
    set('Targets', jarray.array(newTargets, ObjectName))
    print 'Deleting workmanager %s' % (
    delete(, 'WorkManagers')


Note: In the above sample Python files, connectAndEdit(), saveAndExit() are utility functions defined in the file in the WebLogic plugin. To see other utility functions, refer to the file.