Running administrative commands using properties files

Use the wsadmin tool to run an existing administrative command using properties file based configuration. The command must not contain a parameter that uses a complex data type. Supported parameter types are basic types such as String, Long, Integer, Float, Double, Boolean, Character, Short, Byte, URL, and ObjectName, and complex types such as Array of basic types, Properties, DownLoadFile, and UpLoadFile.

Before you begin

Determine the administrative command that you want to run. Ensure that all parameters in the command use only a supported data type.

About this task

You can extract the properties that are required to run a command using the createPropertiesFileTemplates command. Specify GenericType for the configType parameter and a commandName option.

After extracting a properties file for a command, edit the properties file as needed, and then validate and apply the properties file.

For each of the commands in this topic, you can run in interactive mode by specifying the interactive parameter:
AdminTask.command_name('-interactive')
Avoid trouble: Commands identified in the properties file are run twice (as a default) when you use the applyConfigProperties command. The first command run occurs during validation and a second command run occurs if the validation is successful.

Some commands cannot run twice successfully, such as commands that immediately update passwords. This condition causes an error in running the commands twice. You can avoid this error possibility by running the applyConfigProperties command and using the -validate false option.

Procedure

  1. Start the wsadmin scripting tool.
    To start wsadmin using the Jython language, run the following command from the bin directory of the server profile:
    wsadmin -lang jython
  2. Extract the properties that are required to run the administrative command.

    To extract the properties that are required to run a command, use the createPropertiesFileTemplates command. Specify GenericType for the configType parameter and commandName command_name for the options parameter.

    For example, to extract properties for the createSIBus command to a file named createSIBus.props, run the following command:

    AdminTask.createPropertiesFileTemplates('[-propertiesFileName createSIBus.props
      -configType GenericType -options [[commandName createSIBus]] ]')

    The resulting createSIBus.props file contains the following extracted properties:

    #
    CreateDeleteCommandProperties=true
    #SKIP=true
    commandName=createSIBus
    #
    
    #
    #Properties
    #
    busSecurity=false #Boolean
    highMessageThreshold=null #Long
    bus=myBus #String,required
    …
  3. Open an editor on the extracted properties file and modify the extracted properties file as needed.

    Ensure that the extracted properties file provides suitable values for required parameters.

  4. Apply the properties file using the applyConfigProperties command.

    For example, to apply the createSIBus.props properties file, run following wsadmin command:

    AdminTask.applyConfigProperties('[-propertiesFileName createSIBus.props]')

Results

The administrative command runs and applies the properties file.

What to do next

Save the changes to your configuration.