IBM Support

Introducing Properties File Based Configuration - A way to automate WebSphere configuration changes without extensive scripting skills (Part 2)

Technical Blog Post


Abstract

Introducing Properties File Based Configuration - A way to automate WebSphere configuration changes without extensive scripting skills (Part 2)

Body

 

by Yan Zhao and Sangwon Oh

 

In this part 2, we are going into more details of each command for Properties file based configuration.

Here are the commands:

  •         extractConfigProperties
    •             Extracts configuration data to a human readable text file
  •         validateConfigProperties
    •             Validates and determines whether properties file can be applied to environment or not
  •         applyConfigProperties
    •             Applies configuration from properties file to current environment
  •         deleteConfigProperties
    •             Deletes configuration objects using properties file
  •         createPropertiesFileTemplates
    •             Creates template properties files which are used to create or delete specific object types    

1. AdminTask.extractConfigProperties    

  • AdminTask.extractConfigProperties    
    • Target object        
    • Required parameter
      • -propertiesFileName         (String)
    • Optional parameter
      • -configData                       (String)
      • -filterMechanism               (String)
        • All
        • NO_SUBTYPES
        • SELECTED_SUBTYPES
      • -selectedSubTypes          (String)
      • -options                            (Properties)

This command extracts configuration data to a specified properties file.  The command either takes target object or config data specified by -configData parameter. The -configData parameter can be fine-grained by using parameters such as -filterMechanism or -selectedSubTypes.  If no target object or –configData specified, the entire cell will be extracted.  

For -filterMechanism, you can specify All to extract all configuration properties. If you specify NO_SUBTYPES, it will extract the properties of the given object without including the subtypes, and you can specify SELECTED_SUBTYPES to extract specific configuration object subtypes specified with the selectedSubTypes parameter.

The -selectedSubTypes specifies the configuration properties to include or exclude when the command extracts the properties. Specify this parameter if you set the filterMechanism parameter to NO_SUBTYPES or SELECTED_SUBTYPES. The following strings are two examples of subtypes: ApplicationServer or EJBContainer.

The -options specifies additional configuration options, such as GENERATETEMPLATE=true.

 

Here's some examples on how to use this command:

  • extracts node configuration
    • AdminTask.extractConfigProperties('[-propertiesFileName nodeConfig.props -configData Node=MyNode]')
  • extracts server configuration
    • AdminTask.extractConfigProperties('[-propertiesFileName serverconfig.props -configData Server=server1]')
  • extracts WebContainer and EJBContainer configuration from server
    • AdminTask.extractConfigProperties('[-propertiesFileName serverConfig.props -configData Server=server1 -filterMechanism SELECTED_SUBTYPES -selectedSubTypes [EJBContainer WebContainer]]')
  • extracts server configuration using config ID
    • serverID = AdminConfig.getid("/Node:MyNode01/Server:MyServer1/" ) 'MyServer1(cells/dmgrCell/nodes/MyNode01/servers/server1|server.xml#Server_1378420059596)'
    • AdminTask.extractConfigProperties(serverID, '-propertiesFileName serverConfig.props') 

 

2. AdminTask.validateConfigProperties

  • AdminTask.validateConfigProperties
    • Required parameter
      • -propertiesFileName              (String)
    • Optional parameter
      • -variablesMapFileName        (String)
      • -variablesMap                        (Properties)
      • -reportFileName                    (String)
      • -reportFilterMechanism         (String)
      • -zipFileName                         (String)

This command validates whether properties file can be successfully applied to the new configuration or not.  Command returns 'true' or 'false' and also a report file can be generated for troubleshooting.

The -reportFilterMechanism specifies the type of report filter mechanism. Specify All to display all report information. Specify Errors to display error information. Specify Errors_And_Changes to display error and change information. The -zipFileName specifies the name of the compressed file that contains the policy sets that you want to apply to the cell.

 

Here's an example on how to use this command:

  • Validates cell config
    • AdminTask.validateConfigProperties('[-propertiesFileName cellconfig.props -reportFileName report.txt -reportFilterMechanism Errors_And_Changes]')  

 

3. AdminTask.applyConfigProperties

  • AdminTask.applyConfigProperties
    • Required parameter
      • -propertiesFileName              (String)
    • Optional parameter
      • -variablesMapFileName        (String)
      • -variablesMap                        (Properties)
      • -reportFileName                    (String)
      • -reportFilterMechanism         (String)
        • All
        • Errors
        • Errors_And_Changes
      • -validate                                 (Boolean)
      • -zipFileName                         (String)

This command applies properties file to the configuration. If config object exists, then it updates the configuration. If it doesn't exist, it will create config data based on properties file.  It also can generate a report file for troubleshooting.

The -reportFilterMechanism specifies the type of report filter mechanism. Specify All to display all report information. Specify Errors to display error information. Specify Errors_And_Changes to display error and change information.  The -validate specifies whether to validate the properties file before applying the changes. By default, the command validates the properties file. Specify false to disable validation.

 

Here's an example on how to use this command:

  • Applies server config
    • AdminTask.applyConfigProperties('[-propertiesFileName serverConfig.props]')

 

 4. AdminTask.deleteConfigProperties

  • AdminTask.deleteConfigProperties
    • Required parameter
      • -propertiesFileName              (String)
    • Optional parameter
      • -variablesMapFileName        (String)
      • -variablesMap                        (Properties)
      • -reportFileName                    (String)
      • -reportFilterMechanism         (String)
        • All
        • Errors
        • Errors_And_Changes
      • -validate                                (Boolean)

This command deletes properties in your configuration as designated in a properties file. The system removes the attributes or configuration data that corresponds to each property in the properties file.

 

Here's an example on how to use this command:

  • Deletes config objects
    • AdminTask.deleteConfigProperties(['-propertiesFileName', 'myPropFile.props'])

 

5. AdminTask.createPropertiesFileTemplates

  • AdminTask.createPropertiesFileTemplates
    • Required parameter
      • -propertiesFileName        (String)
    • Optional parameter
      • -configType                      (String)
        • Server
        • ServerCluster
        • Application
        • AuthorizationGroup

This command creates template properties files to use to create or delete specific object types. The command stores the template in the properties file specified by the propertiesFileName parameter.

The -configType specifies the resource type for the template to create. You can specify Server to create a server type template, or specify ServerCluster to create a server cluster type template. If you specify Application, you can create an application type  template. And specifying AuthorizationGroup creates an authorization group type template.

 

Here's an example on how to use this command:

  • Creates templates
    • AdminTask.createPropertiesFileTemplates(['-propertiesFileName', 'serverTemplate.props', '-configType', 'Server'])

 

Related Links:

 Introducing Properties File Based Configuration - A way to automate WebSphere configuration changes without extensive scripting skills (Part 1)

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"","label":""},"Component":"","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

UID

ibm11080915