Production Operations Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Propagation Ant Task Reference

This chapter describes the attributes, modifiers, and usage of the propagation Ant tasks. The Ant tasks are broken down into online and offline tasks. Online tasks interact directly with a WebLogic Portal application that is running on a server. Offline tasks interact with previously exported inventory files.

Tip: For a general overview of the Ant tasks, including use cases and examples, see Using the Propagation Ant Tasks.

This chapter includes the following sections:

 


Online Tasks

This section describes each of the online propagation Ant tasks. For an introduction to online tasks, see Overview of Online Tasks. The online tasks described in this section include:

OnlineCheckMutexTask

Verify that the propagation servlet is not currently in use by another process. The mutex is scoped to the application, and is cluster aware. This means that if anyone is using the servlet in a particular application on any node in the cluster, the mutex is enforced: another user cannot use the servlet for that application on another node.

Tip: The propagation servlet executes propagation tasks on the server. This servlet performs operations on WebLogic Portal data, and therefore does not allow more than one thread of execution at a time. For more information on the propagation servlet, see Deploying the Propagation Servlet.

Attributes

Ant Condition Property

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if another thread has the mutex. The script must wait for the other thread to complete. See also Troubleshooting Online Tasks.

Usage

Listing 9-1 checks to see if the propagation servlet is in use. The script retries 10 times. Listing 9-2 uses an Ant conditional to test for success. If the task succeeds, a message is printed.

Listing 9-1 OnlineCheckMutexTask Example
<target name="checkMutexDest"  description="checks to see if the mutex is available">
    <onlineCheckMutex
        servletURL="http://localhost:7001/myProjectPropagation/inventorymanagement"
        username="weblogic"
        password="weblogic"
        allowHttp="true"
        failOnError="false"
        retryTimes="10"
    />
</target>
Listing 9-2 OnlineCheckMutexTask with Ant Conditional
<target name="checkMutexDest" description="checks to see if the mutex is available">
    <condition property="mutex_success">
        <onlineMutex
        servletURL="http://localhost:7001/myProjectPropagation/inventorymanagement"
        username="weblogic"
        password="weblogic"
        allowHttp="true"
        failOnError="false"
        retryTimes="10"
    />

    </condition>
    <antcall target="mutex_success" />
</target>

<target name="mutex_success" if="mutex_success">
    <echo message="The mutex is available." />
</target>

OnlineCommitTask

This task performs two operations:

WARNING: This task modifies the target application’s configuration. Any users with active sessions may experience unwanted behavior depending on the changes that are being committed. The risk to users is similar to the behavior they would see if an administrator made the same changes with the WebLogic Portal Administration Console.

Attributes

Modifiers

This section describes the <modifier> attributes available for this task. Each <modifier> attribute has a name and a value. See the Usage section for an example of using modifiers.

Ant Conditional Support

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if the inventory is not committed successfully. Check the log files for additional information. See also Troubleshooting Online Tasks.

Usage

The following example commits the inventory file uploaded to the destination server with the OnlineUploadTask, which places the file in a standard location.

Listing 9-3 OnlineCommitTask Example
<target name="commitOpt">
    <onlineCommit
        servletURL="http://localhost:7001/myProjectPropagation/inventorymanagement"
        username="weblogic"
        password="weblogic"
        allowHttp="true"
    >
        <modifier name="differenceStrategy" value="optimistic" />
        <modifier name="cm_checkinComment" value="My sample checkin comment." />
    </onlineCommit>
</target>

OnlineDownloadTask

Download the inventory from a currently running WebLogic Portal application to a specified ZIP file.

Note: This task extracts the portal inventory and attempts to write it to a ZIP file. If the ZIP file created exceeds 4 GB, this task fails and a message is written to the server log and the verbose log. If this occurs, try scoping your inventory to limit the size of the resulting archive file. See Understanding Scope for more information.

Attributes

Ant Conditional Support

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if the inventory is not downloaded successfully. Check the log files for more information. See also Troubleshooting Online Tasks.

Usage

The following example downloads an inventory file called dest.zip.

Listing 9-4 OnlineDownloadTask Example
<target name="downloadDest">
    <onlineDownload
    servletURL="http://localhost:7001/myProjectPropagation/inventorymanagement"
    username="weblogic"
    password="weblogic"
    allowHttp="true"
    outputInventoryFile="${portal.prop.home}/test/ant/dest.zip"
    />
</target>

OnlineMaintenanceModeTask

In order to maintain data integrity during a propagation session, the applications on the source and destination servers must be placed into maintenance mode. Maintenance mode prevents administrators from making changes to the portal through the WebLogic Portal Administration Console. Maintenance mode takes effect for the entire enterprise application (not just a single web application) and it takes effect for all nodes in a cluster. After the export of the finalized inventory is complete, you can turn maintenance mode off to enable the applications on the server for modifications.

This task toggles the state of maintenance mode on the server. This Ant task causes delegated administration and entitlements to deny access to all resources with policies within the application regardless of requested resource or capability.

Tip: You can also set Maintenance Mode in the WebLogic Portal Administration Console, select Configurations > Service Administration. For more information, refer to the online help.

Attributes

Ant Condition Property

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if maintenance mode could not be toggled. Check the Maintenance mode state in the WebLogic Portal Administration Console. See also Troubleshooting Online Tasks.

Usage

Listing 9-5 places the server into maintenance mode. Listing 9-6 uses an Ant conditional to place the server in maintenance mode and print a message if the operation is successful.

Listing 9-5 OnlineMaintenanceModeTask Example
<target name="lockDest" description="lock the server">
    <onlineMaintenanceMode
        servletURL="http://localhost:7001/propagation/inventorymanagement"
        username="weblogic"
        password="weblogic"
        allowHttp="true"
        enable="true"
    />
</target>
Listing 9-6 Using OnlineMaintenanceModeTask with an Ant Conditional
<target name="lockDestC1" description="lock the server">
     <condition property="lock_success">
        <onlineMaintenanceMode
            servletURL="http://localhost:7001/propagation/inventorymanagement"
            username="weblogic"
            password="weblogic"
            allowHttp="true"
            enable="true"
        />
    </condition>
    <antcall target="lock_success" />
</target>
<target name="locksuccess" 
        if="lock_success">
            <echo message="Maintenance mode has been toggled."/>
</target>

OnlinePingTask

Tests if the propagation management servlet is running on the designated server. This task verifies that the propagation servlet can be contacted. For information on the propagation servlet, see Deploying the Propagation Servlet.

Attributes

Ant Conditional Support

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if the servlet does not return a successful reply. See also Troubleshooting Online Tasks.

Usage

Listing 9-7 tests to see if the propagation servlet is running. Listing 9-8 uses an Ant conditional to print a message if the task succeeds.

Listing 9-7 OnlinePingTask Example
<target name="pingDest" description="ping the server">
    <onlinePing
        servletURL="http://localhost:7001/propagation/inventorymanagement"
        username="weblogic"
        password="weblogic"
        allowHttp="true"
    />
</target>
Listing 9-8 OnlinePingTask Example with Ant Conditional
<target name="pingDest" description="ping the server">
    <condition property="ping_success">
        <onlinePing
            servletURL="http://localhost:7001/propagation/inventorymanagement"
            username="weblogic"
            password="weblogic"
            allowHttp="true"
        />

    </condition>
    <antcall target="ping_success" />
</target>

<target name="ping_success" if="ping_success">
     <echo message="The server is available." />
</target>

OnlineUploadTask

This task uploads an inventory file to a temporary location associated with a running WebLogic Portal application. You must execute this task before you execute the OnlineCommitTask. Only one inventory can be uploaded at a time.

This task overwrites an existing inventory file that exists in the upload location.

Note: This task only moves a file. It does not affect the configuration of the running application. This operation is safe to do even with active users on the system.
Note: The propagation management servlet has a configuration setting to help mitigate “denial of service” attacks. The servlet is configured with a maximum size allowed for uploaded files (files uploaded over HTTP). By default, this is set to 1 MB. If any given file inside the inventory ZIP file is larger than this value, it will be rejected. The simplest way to work around this limit is to physically copy the inventory to the destination server, and then use the readFromServerFileSystem attribute of this task. For information on changing the servlet configuration to allow larger files, see Increasing the Default Upload File Size.

Attributes

Ant Condition Property

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if the upload fails. Check log files for more information. See also Troubleshooting Online Tasks.

Usage

The following example uploads a file called combined.zip to the server.

Listing 9-9 OnlineUploadTask Example
<target name="upload">
    <onlineUpload
        servletURL="http://localhost:7001/propagation/inventorymanagement"
        username="weblogic"
        password="weblogic"
        allowHttp="true"
        sourceFile="${portal.prop.home}/test/ant/combined.zip"
    />
</target>

 


Offline Tasks

This section describes each of the offline propagation Ant tasks. For an introduction to offline tasks, see Overview of Offline Tasks. The offline tasks described in this section include:

OfflineCombineTask

Combines two inventories and reports in a change manifest file the differences as a set of adds, updates, and deletes.

Note: This task extracts the portal inventory and attempts to write it to a ZIP file. If the ZIP file created exceeds 4 GB, this task fails and a message is written to the server log and the verbose log. If this occurs, try scoping your inventory to limit the size of the resulting archive file. See Understanding Scope for more information. For information on the verbose log, see Reviewing Log Files.
Note: This task extends the OfflineDiffTask task, so all attributes available for OfflineDiffTask can be used with this task too.

Attributes

Ant Condition Property

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if no differences were found between the two inventories. See also Troubleshooting Offline Tasks.

Usage

The following example combines two inventories. Note that some of the attributes are taken from the OfflineDiffTask.

Listing 9-10 OfflineCombineTask Example
<target name="combine" description="Combine two inventories with logging">
    <offlineCombine
         sourceFile="${portal.prop.home}/test/ant/src.zip"
         destFile="${portal.prop.home}/test/ant/dest.zip"
         combinedInventoryFile="${portal.prop.home}/test/ant/combined.zip"
         changeManifestFile="${portal.prop.home}/test/ant/combine_cm.xml"
         logFile="${portal.prop.home}/test/ant/combine_log.txt"
         verboseLogFile="${portal.prop.home}/test/ant/combine_verboselog.txt"
    />
</target>

OfflineDiffTask

Compares two inventories and reports the differences in a change manifest file as a set of adds, updates, and deletes.

Attributes

Ant Conditional Support

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if no differences are found. See also Troubleshooting Offline Tasks.

Usage

Listing 9-11 writes the differences between two files to a change manifest file.

Listing 9-11 OfflineDiffTask Example
<target name="diff" description="compare two inventories with logging">
    <offlineDiff
        sourceFile="${portal.prop.home}/test/ant/src.zip"
        destFile="${portal.prop.home}/test/ant/dest.zip"
        logFile="${portal.prop.home}/test/ant/diff_log.txt"
        verboseLogFile="${portal.prop.home}/test/ant/diff_verboselog.txt"
    />
</target>

OfflineElectionAlgebraTask

Allows for algebraic operations on two change manifest files. This task is not commonly used.

Attributes

Ant Condition Property

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if the algebraic operation failed. See also Troubleshooting Offline Tasks.

Usage

Listing 9-12 adds the contents of two change manifests. Listing 9-13 subtracts the contents of two change manifests.

Listing 9-12 OfflineElectionAlgebraTask Example: Add
<target name="electionsAdd" description="add the two election lists">
    <offlineAlgebra
        electionList1File="${portal.prop.home}/test/ant/elections1.xml"
        electionList2File="${portal.prop.home}/test/ant/elections2.xml"
        operation="add"
        outputFile="${portal.prop.home}/test/ant/addedElections.xml"
    />
</target>
Listing 9-13 OfflineElectionAlgebraTask Example: Subtract
<target name="electionsSubtract" description="subtract the two election lists">
/>
    <offlineAlgebra 
        electionList1File="${portal.prop.home}/test/ant/elections1.xml"
        electionList2File="${portal.prop.home}/test/ant/elections2.xml"
        operation="subtract"
        outputFile="${portal.prop.home}/test/ant/subtractedElections.xml"
    />

</target>

OfflineExtractTask

Extracts top level files from an inventory file. These files are stored in an inventory ZIP file at the top level of the file, and can include a change manifest file, export file, manual changes file, policy file, and scope file.

Attributes

Ant Conditional Support

This task does not support the Ant condition task.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if any problems were encountered during the operation. See also Troubleshooting Offline Tasks.

Usage

The following example extracts specified files from an inventory file.

Listing 9-14 OfflineExtractTask Example
<target name="extractCombined" description="gather resources from the combined inventory">
    <offlineExtract
        sourceFile="${portal.prop.home}/test/ant/combined.zip"
        exportFile="${portal.prop.home}/test/ant/extractCombined_export.properties"
        scopeFile="${portal.prop.home}/test/ant/extractCombined_scope.properties"
        policyFile="${portal.prop.home}/test/ant/extractCombined_policy.properties"
        changemanifestfile="${portal.prop.home}/test/ant/extractCombined_change.xml"
        logFile="${portal.prop.home}/test/ant/extractCombined_log.txt"
        verboseLogFile="${portal.prop.home}/test/ant/extractCombined_verboselog.txt"
    />
</target>

OfflineInsertTask

Inserts top level files into an inventory file. These files are stored in an inventory ZIP file at the top level of the file, and can include a change manifest file, export file, manual changes file, policy file, and scope file.

Attributes

Ant Conditional Support

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if the operation fails. See also Troubleshooting Offline Tasks.

Usage

The following example inserts specified files into an inventory.

Listing 9-15 OfflineInsertTask Example
<target name="insertCombined" description="insert resources into combined inventory">
     <offlineInsert
         sourceFile="${portal.prop.home}/test/ant/combined.zip"
         policyFile="${portal.prop.home}/test/ant/extractCombined_policy.properties"
         changemanifestfile="${portal.prop.home}/test/ant/extractCombined_change.xml"
         outputFile="${portal.prop.home}/test/ant/newCombined.zip"
     />
</target>

OfflineListPoliciesTask

Exports the valid policies from an inventory file. These policies are written into a .properties text file. You can later edit this property file and use it as an input into other tasks, such as OfflineCombineTask. See also Using Policies.

Attributes

Ant Conditional Support

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if the operation fails. The script can fail if there is a problem walking the inventory tree. See also Troubleshooting Offline Tasks.

Usage

The following example writes the policy file for the portal application.

Listing 9-16 OfflineListPoliciesTask Example
<offlineListPolicies 
   sourceFile="${portal.prop.home}/test/ant/src.zip"
   policyFile="${portal.prop.home}/test/ant/listPolicies_policies.properties"
   globalAddFlag="true"
   globalUpdateFlag="false"
   globalDeleteFlag="true"
   logFile="${portal.prop.home}/test/ant/listPolicies_log.txt"
   verboseLogFile="${portal.prop.home}/test/ant/listPolicies_verboselog.txt"
/>

OfflineListScopesTask

Exports the valid scoping information from an inventory file. Scopes are written into a .properties text file. You can later edit this property file and use it as an input into other tasks, such as OfflineCombineTask. See also Using Policies.

Attributes

Ant Conditional Support

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if there was a problem traversing the inventory tree. See also Troubleshooting Offline Tasks.

Usage

The following example exports the scoped artifacts to a property file, using the default depth value of 3.

Listing 9-17 OfflineListScopesTask Example
<target name="listScopes" description="lists the scopes found in the source inventory">
    <offlineListScopes
        sourceFile="${portal.prop.home}/test/ant/src.zip"
        scopeFile="${portal.prop.home}/test/ant/listScopes_scopes.properties"
        logFile="${portal.prop.home}/test/ant/listScopes_log.txt"
        verboseLogFile="${portal.prop.home}/test/ant/listScopes_verboselog.txt"
    />
</target>

OfflineSearchTask

Searches an inventory for node names that match the specified string. The search string is only matched if it occurs in the node name (the last term in the taxonomy).

For example, consider the following inventory:

1. Application

2. Application:PersonalizationService

3. Application:PersonalizationService:EventService:redEvent.evt

4. Application:PersonalizationService:EventService:coloredEvent.evt

5. Application:PersonalizationService:EventService:blueEvent.evt

If you search this inventory for the string red, the task returns nodes 3 and 4. If you search for PersonalizationService, the task returns just node 2.

Attributes

Ant Conditional Support

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

success – One or more matches are found.

failure – No matches are found.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if no matches are found. See also Troubleshooting Offline Tasks.

Usage

Listing 9-18 searches the specified inventory for the string global. Listing 9-19 uses an Ant conditional to print a message if the search succeeds.

Listing 9-18 OfflineSearchTask Example
<target name="search">
    <offlineSearch|
        searchString="global"
        sourceFile="${portal.prop.home}/test/ant/src.zip"
        listFile="${portal.prop.home}/test/ant/search.txt"
        logFile="${portal.prop.home}/test/ant/search_log.txt"
        verboseLogFile="${portal.prop.home}/test/ant/search_verboselog.txt"
    />
</target>
Listing 9-19 OfflineSearchTask Example with Ant Conditional
<target name="searchC1" description="finds the nodes that contain the search string in
the name">
        <condition property="search_success">
             <offlineSearch
                 searchString="esktop"
                 sourceFile="${portal.prop.home}/test/ant/src.zip"
             />
        </condition>

    <antcall target="search_success" />
</target>
<target name="search_success" if="search_success"><echo message="The search     succeeded." />
</target>

OfflineValidateTask

Verifies that the source ZIP file contains a valid portal application inventory. Use this task after moving or downloading an inventory to ensure that it was transferred successfully. This task ensures that the ZIP file’s internal structure adheres to an exported inventory. It does not validate the XML of every node in the inventory tree.

Attributes

Ant Condition Property

This task supports the Ant condition task. The condition task’s property is set if the Ant task succeeds.

On Failure

If the failOnError attribute is set to true (the default), the script terminates if the file is not a valid inventory file. See also Troubleshooting Offline Tasks.

Usage

The following example validates the inventory file called src.zip.

Listing 9-20 OfflineValidateTask Example
<target name="validateSrc" description="valid inventory, with logging">
    <offlineValidate
    sourceFile="${portal.prop.home}/test/ant/src.zip"
    logFile="${portal.prop.home}/test/ant/validateSrc_log.txt"
    verboseLogFile="${portal.prop.home}/test/ant/validateSrc_verboselog.txt"
    />
</target>

  Back to Top       Previous  Next