Deleting files from multiple registered hosts with a single REST call
You can delete files on multiple registered hosts of a collective from a collective controller by invoking the DELETE REST API. The file deletions occur within an IBM JMX REST Connector.
Before you begin
Create a collective controller. See Configuring a Liberty collective.
Register each remote host computer with the collective controller. See Registering host computers with a Liberty collective.
Procedure
- Optional: To read about the REST APIs, point
a browser at https://controller_host_name:controller_port_name/IBMJMXConnectorREST/api and
enter the controller administrative user ID and password to log in.
The controller must be running to view the REST API documentation.
The File Transfer and Routing sections describe the APIs used to transfer files between the collective controller and a member server or a registered host.
The collectiveController-1.0 feature enables the restConnector-1.0 feature, which provides file transfer capability. Thus, collective controllers do not need to specify restConnector-1.0 in a feature manager to view the REST APIs or perform file transfer operations. A stand-alone server configuration might need the restConnector-1.0 feature to view the REST APIs.
- List the target hosts in an HTTP header
for the collective controller.
com.ibm.websphere.collective.hostNames=comma-separated_list_of_target_hosts
Optionally, set other HTTP headers:
- Specify whether to perform the file deletion and the action asynchronously.
Default is false. To change the default, specify true for boolean.
com.ibm.websphere.jmx.connector.rest.asyncExecution=boolean
- Specify a set of actions to perform before the file deletion.
An existing built-in action is com.ibm.websphere.jmx.connector.rest.preTransferAction.remove,
which removes the Liberty servers inside the Liberty directory to
be deleted from the collection. Use the header to list other custom
actions. If you list more than one custom action, delimit the action
with a URL-encoded comma character.
com.ibm.websphere.jmx.connector.rest.preTransferAction=comma-separated_list_of_actions
To enable the custom actions, add the following configuration to the collective controller server.xml:<hostAccess enableCustomActions="true" />
- Specify a list of options to pass into the pre-transfer actions.
This list of options must be either null or contain the same number
of list items as the preTransferAction header list,
where the item index of each option must match the index of its corresponding
action. If you list more than one option, delimit the action with
a URL-encoded comma character.
com.ibm.websphere.jmx.connector.rest.preTransferAction.options=comma-separated_list_of_options
If you specify the built-in action com.ibm.websphere.jmx.connector.rest.preTransferAction.remove, the corresponding option must be:
--user=adminUser --password=adminPw --keystorePassword=keystorePw [--rpcUser=rpcUser --rpcPassword=rpcPw]
- Specify credentials to use for the delete action. The payload
of the header is a JSON object where each JSON key is an environment
variable and each JSON value is its corresponding value. If you specify
system paths, use forward slashes (/).
com.ibm.websphere.jmx.connector.rest.transferCredentials=list_of_environment_variables
- Specify environment variables to set before the actions run. The
payload of the header is a JSON object where each JSON key is an environment
variable and each JSON value is its corresponding value. If you specify
system paths, use forward slashes (/).
com.ibm.websphere.jmx.connector.rest.transferEnvVars=list_of_environment_variables
- Specify whether to perform the file deletion and the action asynchronously.
Default is false. To change the default, specify true for boolean.
- Delete a file from multiple registered hosts using the DELETE operation.
- Ensure the target location is within a configurable write directory of the hosts.
- Invoke the DELETE operation.
DELETE https://controller_host:controller_port/IBMJMXConnectorREST/file/{filePath}[?recursiveDelete=boolean]
- {filePath} is a UTF-8 URL-encoded absolute path that specifies the target location. For example, if the file is C:/temp/myFile.txt, the path is C%3A%2Ftemp%2FmyFile.txt.
- recursiveDelete is an optional query parameter that deletes non-empty directories. The default value is false.
What to do next
Get status or details on the REST call. See Getting status on a REST call for multiple registered hosts.


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-libcore-mp&topic=twlp_collective_file_delete_multihost
File name: twlp_collective_file_delete_multihost.html