Calling the wladm Ant task
Syntax
Call the wladm Ant task as follows:
<wladm url=... user=... password=...|passwordfile=... [secure=...]> some commands </wladm>
Attributes
The wladm Ant task has the following attributes:
Attribute Description Required Default url The base URL of the MobileFirst web application for administration services Yes secure Whether to avoid operations with security risks No true user User name for accessing the MobileFirst administration services Yes password Password for the user Either one is required passwordfile The file containing the password for the user
- url
The base URL preferably uses the HTTPS protocol. For example, if we use default ports and context roots, use the following URL.
- For WAS: https://server:9443/worklightadmin
- For Tomcat: https://server:8443/worklightadmin
- secure
- Default is true. Setting secure="false" might have the following effects:
- User and password might be transmitted in an unsecured way, possibly even through unencrypted HTTP.
- The server's SSL certificates are accepted even if self-signed or if they were created for a different host name than the specified server's host name.
- password
Specify the password either in the Ant script, through the password attribute, or in a separate file that you pass through the passwordfile attribute. We must prevent other users on the same computer from knowing this password. To secure the password, before you enter the password into a file, remove the read permissions of the file for users other than yourself.
- On UNIX: chmod 600 adminpassword.txt
- On Windows: cacls adminpassword.txt /P Administrators:F %USERDOMAIN%\%USERNAME%:F
Additionally, you might want to obfuscate the password to hide it from an occasional glimpse. To do so, use the wladm config password command to store the obfuscated password in a configuration file. Then, we can copy and paste the obfuscated password to the Ant script or to the password file.
The wladm call contains commands that are encoded in inner elements. These commands are executed in the order in which they are listed. If one of the commands fails, the remaining commands are not executed, and the wladm call fails.
Elements
Use the following elements in wladm calls:
Element Description Count show-info Shows user and configuration information 0..∞ show-versions Shows versions information 0..∞ list-runtimes Lists the runtimes 0..∞ show-runtime Shows information about a runtime 0..∞ delete-runtime Deletes a runtime 0..∞ list-adapters Lists the adapters 0..∞ deploy-adapter Deploys an adapter 0..∞ show-adapter Shows information about an adapter 0..∞ delete-adapter Deletes an adapter 0..∞ adapter Other operations on an adapter 0..∞ list-apps Lists the apps 0..∞ deploy-app Deploys an app 0..∞ show-app Shows information about an app 0..∞ delete-app Deletes an app 0..∞ delete-app-version Delete a version of an app 0..∞ app-version Other operations on an app 0..∞ list-beacons Lists the beacons 0..∞ set-beacon Specifies information about a beacon 0..∞ show-beacon Shows information about a beacon 0..∞ remove-beacon Removes information about a beacon 0..∞ list-beacon-triggers Lists the beacon triggers 0..∞ set-beacon-trigger Specifies a beacon trigger 0..∞ show-beacon-trigger Shows a beacon trigger 0..∞ delete-beacon-trigger Deletes a beacon trigger 0..∞ list-beacon-trigger-associations Lists the associations between beacons and beacon triggers 0..∞ set-beacon-trigger-association Specifies an association between a beacon and a beacon trigger 0..∞ show-beacon-trigger-association Shows the association between a beacon and a beacon trigger 0..∞ delete-beacon-trigger-association Deletes the association between a beacon and a beacon trigger 0..∞ list-devices Lists the devices 0..∞ remove-device Removes a device 0..∞ device Other operations for a device 0..∞
XML Format
The output of most commands is in XML, and the input to specific commands, such as <set-accessrule>, is in XML too. We can find the XML schemas of these XML formats in the MF_HOME/WorklightServer/wladm-schemas/ directory. The commands that receive an XML response from the server verify that this response conforms to the specific schema. We can disable this check by specifying the attribute xmlvalidation="none".
Output character set
Normal output from the wladm Ant task is encoded in the encoding format of the current locale. On Windows, this encoding format is the so-called "ANSI code page". The effects are as follows:
- Characters outside of this character set are converted to question marks when they are output.
- When the output goes to a Windows command prompt window (cmd.exe), non-ASCII characters are incorrectly displayed because such windows assume characters to be encoded in the so-called "OEM code page".
To work around this limitation:
- On operating systems other than Windows, use a locale whose encoding is UTF-8. This locale is the default locale on Red Hat Linux and OS X. Many other operating systems have the en_US.UTF-8 locale.
- Or use the attribute output="some file name" to redirect the output of a wladm command to a file.
Parent topic: wladm Ant task