7 Updating the Deployment Plan

You can use WebLogic Scripting Tool (WLST) to retrieve and update an application's deployment plan. When using WLST to update an application's deployment plan, you define variable definitions and variable assignments. A variable definition identifies a new value; a variable assignment associates the new value with the descriptor entity to be changed.

The following procedure describes how to use WLST in interactive mode. For information about using WLST in script or embedded mode, see Using the WebLogic Scripting Tool.

To update a deployment plan using WLST in interactive mode, perform the following steps:

Note:

The example commands provided in the following procedure demonstrate how to update and configure the MedRec application, which is installed on your system if you installed the Server Examples.

  1. Create a deployment plan for the application.

    For more information, see "Create a deployment plan" in the Oracle WebLogic Server Administration Console Online Help.

  2. Start WLST in interactive mode.

  3. Enter the following command to load the application and deployment plan. For example:

    plan=loadApplication(loadApplication('c:/Oracle/Middleware/user_projects/
    applications/mydomain/modules/medrec/assembly/target/medrec.ear',
    'c:/Oracle/Middleware/user_projects/applications/mydomain/modules/medrec/
    assembly/target/Plan.xml')
    

    The WLST loadApplication command returns a WLSTPlan object that you can access to make changes to the deployment plan. For more information about the WLSTPlan object, see WLSTPlan Object.

  4. Identify the configuration options that you want to update and their corresponding XPath values. You can determine the XPath value for configuration options by using the weblogic.PlanGenerator utility. You can copy and paste the XPath from the generated plan into your active deployment plan. See "weblogic.PlanGenerator Command Line Reference" in Deploying Applications to Oracle WebLogic Server.

  5. Determine if variable definitions and variable assignments are currently defined in your deployment plan for the configuration options identified in the previous step. To do so, enter one of the following commands:

    1. To display variables:

      plan.showVariables()
      Name                                                       Value
      -----                                                       -----
      SessionDescriptor_cookieMaxAgeSecs_12910569321171              -1
      SessionDescriptor_invalidationIntervalSecs_12910568567990      75
      SessionDescriptor_maxInMemorySessions_12910569321170           -1
      SessionDescriptor_timeoutSecs_12900890060180                3600
      
    2. To display variable assignments:

      plan.showVariableAssignments()
      medrec.ear
         |
        META-INF/weblogic-application.xml
           |
          SessionDescriptor_timeoutSecs_12900890060180
      medrec.ear
         |
        META-INF/weblogic-application.xml
           |
          SessionDescriptor_invalidationIntervalSecs_12910568567990
      medrec.ear
         |
        META-INF/weblogic-application.xml
           |
          SessionDescriptor_maxInMemorySessions_12910569321170
      medrec.ear
         |
        META-INF/weblogic-application.xml
           |
          SessionDescriptor_cookieMaxAgeSecs_12910569321171
      
  6. If the variable definition and assignment are not defined, create them and set the XPath value for the variable assignment, as follows:

    1. Create the variable definition. Use the createVariable() method to specify the variable name and value. For example:

      v=plan.createVariable('new_var', '3')
      
    2. Create the variable assignment. Use the createVariableAssignment() method to specify the name of the variable, the application to which is applies, and the corresponding deployment descriptor. For example:

      va=plan.createVariableAssignment('new_var', 'medrec.ear', 'META-INF/
      weblogic-application.xml')
      Creating VariableAssignment for ModuleOverride medrec.ear and 
      ModuleDescriptor with URI META-INF/weblogic-application.xml.
      Created VariableAssignment with name new_var successfully.
      
    3. Set the XPath value for the variable assignment by pasting the XPath value from the deployment plan you generated with weblogic.PlanGenerator in Step 4. For example:

      va.setXpath('weblogic-application/session-descriptor/new_var')
      

      Note:

      To get the correct XPath values for the desired variable assignment, Oracle recommends that you use the weblogic.PlanGenerator utility to generate a template deployment plan with empty values. You can then cut or copy the XPath values from the template deployment plan and paste them into the WLST script.

  7. Save the deployment plan. For example:

    plan.save()