使用 wsadmin 脚本编制工具修改嵌套属性
可以使用脚本编制和 wsadmin 工具来修改配置对象的嵌套属性。
关于此任务
WebSphere® Application Server 配置对象的属性经常嵌套很深。例如,JDBCProvider 对象有一个属性工厂,这是 J2EEResourceFactory 类型对象的列表。这些对象可以是包含 connectionPool 属性和包含各种基本属性的 ConnectionPool 类型的 DataSource 对象。
过程
示例
修改嵌套属性的另一种方法是直接修改嵌套属性。
使用 Jacl:
set techsamp [$AdminConfig getid /DataSource:TechSamp/]
set pool [$AdminConfig showAttribute $techsamp connectionPool]
$AdminConfig modify $pool {{reapTime 2003}}
使用 Jython 列表:
techsamp=AdminConfig.getid('/DataSource:TechSamp/')
pool=AdminConfig.showAttribute(techsamp,'connectionPool')
AdminConfig.modify(pool,[['reapTime',2003]])
使用 Jython 字符串:
techsamp=AdminConfig.getid('/DataSource:TechSamp/')
pool=AdminConfig.showAttribute(techsamp,'connectionPool')
AdminConfig.modify(pool,'[[reapTime 2003]]')
本示例中,第一个命令获取 DataSource 的配置标识,而第二个命令获取 connectionPool 属性。第三个命令在 ConnectionPool 对象上直接设置 reapTime 属性。