[AIX Solaris HP-UX Linux Windows][IBM i]

Disabling application loading in deployed targets using wsadmin scripting

You can use the AdminConfig object and scripting to disable application loading in deployed targets.

About this task

The following example uses the AdminConfig object to disable application loading in deployed targets:

Procedure

  1. wsadmin 스크립트 도구를 시작하십시오.
  2. 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/")
    Table 1. getid Deployment command elements. Run the getid command to get a deployment object.
    Element Description
    set is a Jacl command
    deployments is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object that represents the WebSphere® Application Server configuration
    getid is an AdminConfig command
    Deployment is an attribute
    myApp is the value of the application name
    문제점 방지 문제점 방지: If you are using the Jython scripting language, make sure that you read the notes concerning a space character within application names.gotcha
    Example output:
    myApp(cells/mycell/applications/myApp.ear/deployments/myApp|deployment.xml#Deployment_1)
  3. Obtain the target mappings in the application and assign them to the targetMappings variable, for example:
    • Using Jacl:
      set deploymentObj1 [$AdminConfig showAttribute $deployments deployedObject]
      
      set targetMap1 [lindex [$AdminConfig showAttribute $deploymentObj1 targetMappings] 0]
      Example output:
      (cells/mycell/applications/ivtApp.ear/deployments/ivtApp|deployment.xml#DeploymentTargetMapping_1)
    • Using Jython:
      deploymentObj1 = AdminConfig.showAttribute(deployments, 'deployedObject')
      
      targetMap1 = AdminConfig.showAttribute(deploymentObj1, 'targetMappings')
      
      targetMap1 = targetMap1[1:len(targetMap1)-1].split(" ")
      
      print targetMap1
      문제점 방지 문제점 방지: When you attempt to obtain the target mappings in the application through scripting and then assigning those values to the targetMappings variable, be aware when the application has a space in the name or blank. In these cases, you must compensate for the occurrence of a blank or space character as the Jython example demonstrates. Errors can occur if you do not make this adjustment. Consider the following scenarios:
      • If only one single DeploymentTargetMapping value exists within the deployment.xml file, you can either split the targetMappings value with a space or a line.separator entry. The line.separator entry syntax works when the application name contains a space, such as "IVT Application". For example:
        targetMap1 = targetMap1[1:len(targetMap1)-1].split(" ")   
        or
        targetMap1 = 
          targetMap1[1:len(targetMap1)-1].split(java.lang.System.getProperty("line.separator"))
      • If multiple DeploymentTargetMapping values exist within the deployment.xml file, split the targetMappings values with a space. However, you must also use "\" and " ", as appropriate, when the application name or deployment target string contains a space character. For example:
        targetMap1 = targetMap1[1:len(targetMap1)-1].split(" ") 
      gotcha
      Example output:
      ['(cells/mycell/applications/ivtApp.ear/deployments/ivtApp|deployment.xml#DeploymentTargetMapping_1)']
    Table 2. showAttribute command elements. Run the showAttribute command to assign target mappings.
    Element Description
    set is a Jacl command
    deploymentObj1 is a variable name
    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object that represents the WebSphere Application Server configuration
    showAttribute is an AdminConfig command
    deployments evaluates the ID of the Deployment object that is specified in step number 1
    deployedObject is an attribute
    targetMap1 is a variable name
    targetMappings is an attribute
    lindex is a Jacl command
    print is a Jython command
  4. Disable the loading of the application on each deployed target, for example:
    • Using Jacl:
      foreach tm $targetMap1 {$AdminConfig modify $tm {{enable false}}}
    • Using Jython:
      for targetMapping in targetMap1: AdminConfig.modify(targetMapping, [["enable", "false"]])
  5. Save the configuration changes.
    다음 명령 예제를 사용하여 구성 변경사항을 저장하십시오.
    AdminConfig.save()
  6. In a network deployment environment only, synchronize the node.
    AdminNodeManagement 스크립트 라이브러리에 있는 syncActiveNode 또는 syncNode 스크립트를 사용하여 구성 변경사항을 노드에 전파하십시오.
    • 다음 명령 데모에 표시된 것과 같이, syncActiveNodes 스크립트를 사용하여 변경사항을 셀 내의 각 노드에 전파하십시오.
      AdminNodeManagement.syncActiveNodes()
    • 다음 명령 데모에 표시된 것과 같이, syncNode 스크립트를 사용하여 변경사항을 특정 노드에 전파하십시오.
      AdminNodeManagement.syncNode("myNode")

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: July 9, 2016 6:14
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_appload
파일 이름:txml_appload.html