Example: Disabling application loading in deployed targets using wsadmin
The following example uses the AdminConfig object to disable application loading in deployed targets:
- Obtain the deployment object for the application and assign it to the deployments variable, for example:
Using Jacl:
set deployments [$AdminConfig getid /Deployment:myApp/]
Using Jython:
deployments = AdminConfig.getid("/Deployment:myApp/")Example output:
myApp(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#Deployment_1)
- Obtain the target mappings in the application and assign them to the targetMappings variable, for example:
Using Jacl:
set deploymentObject [$AdminConfig showAttribute $deployments deployedObject] set targetMappings [lindex [$AdminConfig showAttribute $deploymentObject targetMappings] 0]
Example
output:
(cells/mycell/applications/ivtApp.ear/deployments/ivtApp:deployment.xml#DeploymentTargetMapping_1)
Using Jython:
deploymentObject = AdminConfig.showAttribute(deployments, 'deployedObject') targetMappings = AdminConfig.showAttribute(deploymentObject, 'targetMappings') targetMappings = targetMappings[1:len(targetMappings)-1].split(" ") print targetMappings
Example output:
['(cells/mycell/applications/ivtApp.ear/deployments/ivtApp:deployment.xml#DeploymentTargetMapping_1)']
- Disable the loading of the application on each deployed target, for example:
Using Jacl:
foreach tm $targetMappings { $AdminConfig modify $tm {{enable false}} }
Using Jython:
for targetMapping in targetMappings: AdminConfig.modify(targetMapping, [["enable", "false"]])
- Save the changes with the following command:
Using Jacl:
$AdminConfig save
Using Jython:
AdminConfig.save()