使用 wsadmin 脚本编制来调用 AdminConfig 对象的命令
使用 AdminConfig 对象,以调用配置命令以及创建或更改 WebSphere® Application Server 配置的元素,例如,创建数据源。
如果您只想使用本地操作,那么您可以在服务器不运行时启动脚本编制客户机。要以本地方式运行,使用 -conntype NONE 选项启动脚本编制客户机。您会接收到正在以本地方式运行的消息。如果服务器正在运行,请不要以本地方式运行 AdminConfig 工具。以本地方式进行的配置更改将不会反映到正在运行的服务器配置中。如果您保存冲突的配置,那么会毁坏配置。
在 Deployment Manager 环境中,仅当脚本编制客户机连接到 Deployment Manager 时才可更新配置。
当连接到 Node Agent 或受管的应用程序服务器时,您将无法更新配置,因为这些服务器进程的配置是驻留在 Deployment Manager 的主配置的副本。当在 Deployment Manager 和 Node Agent 之间进行同步配置时,将在节点机器上创建这些副本。通过将脚本编制客户机连接到 Deployment Manager,对服务器进程进行配置更改。出于该原因,要更改配置,不要在节点机器上以本地方式运行脚本编制客户机。它不是支持的配置。

params='[[name name1] [nameInNameSpace nameSpace_Name] [string_to_bind "value, withComma"]]'
AdminConfig.create(type, parent, params)
您还可以使用修改命令:AdminConfig.modify(type, params)
- attributes
- checkin
- convertToCluster
- create
- createClusterMember
- createDocument
- createUsingTemplate
- defaults
- deleteDocument
- existsDocument
- extract
- getCrossDocumentValidationEnabled
- getid
- getObjectName
- getObjectType
- getSaveMode
- getValidationLevel
- getValidationSeverityResult
- hasChanges
- help
- installResourceAdapter
- list
- listTemplates
- modify
- parents
- queryChanges
- remove
- required
- reset
- resetAttributes
- save
- setCrossDocumentValidationEnabled
- setSaveMode
- setValidationLevel
- show
- showall
- showAttribute
- 类型
- uninstallResourceAdapter
- unsetAttributes
- validate
attributes
使用 attributes 命令来返回给定类型的顶级属性列表。
目标对象
无。必需参数
- object type
- 指定基于 XML 配置文件的对象类型的名称。对象类型不必与管理控制台显示的名称相同。
可选参数
无。样本输出
"properties Property*" "serverSecurity ServerSecurity"
"server Server@" "id Long" "stateManagement StateManageable"
"name String" "moduleVisibility EEnumLiteral(MODULE,
COMPATIBILITY, SERVER, APPLICATION)" "services Service*"
"statisticsProvider StatisticsProvider"
示例
- 使用 Jacl:
$AdminConfig attributes ApplicationServer
- 使用 Jython:
print AdminConfig.attributes('ApplicationServer')
checkin
使用 checkin 命令将一个文件检入由文档统一资源标识 (URI) 描述的配置库中。此方法仅适用于 Deployment Manager 配置。
目标对象
无。必需参数
- URI
- 文档 URI 相对于配置库的根,例如:
app_server_root\config
/WebSphere/AppServer/config
\WebSphere\AppServer\config
- file name
- 指定要检入的源文件的名称。
- opaque object
- 指定上一次调用 AdminConfig 对象的 extract 命令所返回的对象。
可选参数
无。样本输出
"properties Property*" "serverSecurity ServerSecurity"
"server Server@" "id Long" "stateManagement StateManageable"
"name String" "moduleVisibility EEnumLiteral(MODULE,
COMPATIBILITY, SERVER, APPLICATION)" "services Service*"
"statisticsProvider StatisticsProvider"
示例
- 使用 Jacl:
$AdminConfig checkin cells/MyCell/Node/MyNode/serverindex.xml /mydir/myfile $obj
$AdminConfig checkin cells/MyCell/Node/MyNode/serverindex.xml c:\\mydir\myfile $obj
$AdminConfig checkin cells/MyCell/Node/MyNode/serverindex.xml \mydir\myfile $obj
- 使用 Jython:
print AdminConfig.checkin('cells/MyCell/Node/MyNode/serverindex.xml', '/mydir/myfile', obj)
print AdminConfig.checkin('cells/MyCell/Node/MyNode/serverindex.xml', 'c:\mydir\myfile', obj)
print AdminConfig.checkin('cells/MyCell/Node/MyNode/serverindex.xml', '\mydir\myfile', obj)
convertToCluster
使用 convertToCluster 命令来转换服务器,使它成为新的服务器集群中的第一个成员。
目标对象
无。必需参数
- server ID
- 所需的服务器的配置标识。
- cluster name
- 指定相关集群的名称。
可选参数
无。样本输出
myCluster(cells/mycell/clusters/myCluster|cluster.xml#ClusterMember_2)
示例
- 使用 Jacl:
set serverid [$AdminConfig getid /Server:myServer/] $AdminConfig convertToCluster $serverid myCluster
- 使用 Jython:
serverid = AdminConfig.getid('/Server:myServer/') print AdminConfig.convertToCluster(serverid, 'myCluster')
create
使用 create 命令以创建配置对象。
目标对象
无。必需参数
- type
- 指定基于 XML 配置文件的对象类型的名称。此参数值不必与管理控制台显示的名称相同。
- parent ID
- 指定父对象的配置标识。
- attributes
- 指定要对配置标识添加的任何属性。
可选参数
无。样本输出
ds1(cells/mycell/nodes/DefaultNode/servers/server1|resources.xml#DataSource_6)
示例
- 使用 Jacl:
set jdbc1 [$AdminConfig getid /JDBCProvider:jdbc1/] $AdminConfig create DataSource $jdbc1 {{name ds1}}
- 使用 Jython 字符串属性:
jdbc1 = AdminConfig.getid('/JDBCProvider:jdbc1/') print AdminConfig.create('DataSource', jdbc1, '[[name ds1]]')
- 使用带有对象属性的 Jython:
jdbc1 = AdminConfig.getid('/JDBCProvider:jdbc1/') print AdminConfig.create('DataSource', jdbc1, [['name', 'ds1']])
- 使用以下示例创建端口:
#replace server1 with your server name serverName = 'server1' #replace smtitant24Node03 with your node name node = AdminConfig.getid('/Node:smtitan24Node03') #print node serverEntries = AdminConfig.list('ServerEntry', node).split(java.lang.System.getProperty('line.separator')) for serverEntry in serverEntries: sName = AdminConfig.showAttribute(serverEntry, "serverName") if sName == serverName: #print serverEntry #replace OVERLAY_TEST with the value you want for your endPointName id = AdminConfig.create('NamedEndPoint', serverEntry, '[[endPointName "OVERLAY_TEST"]]') #print id start = id.find('#') #print start end = id.find(')',start) #print end str = id[start:end] server = id[0:start] #print server #print str #replace 8888 with the value you want for your port AdminConfig.create('EndPoint', server+str+')', '[[port "8888"] [host "*"]]') AdminConfig.save() #AdminConfig.reset()
createClusterMember
使用 createClusterMember 命令在由 node id 参数指定的节点上创建新的服务器对象。此服务器创建为 cluster id 参数指定的现有集群的新成员,并包含 member attributes 参数中指定的属性。此服务器是使用 template id 属性指定的服务器模板创建的,并包含 memberName 属性指定的名称。 memberName 属性是必需的。模板选项只能用于创建的第一个集群成员。在第一个集群成员之后创建的所有集群成员都相同。
目标对象
无。必需参数
- cluster ID
- 指定相关集群的配置标识。
- node ID
- 指定相关节点的配置标识。
- template ID
- 指定要用于创建服务器的模板标识。
- 成员属性
- 指定要对集群成员添加的任何属性。memberName 属性是必需的,它定义要创建的集群成员的名称。
可选参数
无。样本输出
myCluster(cells/mycell/clusters/myCluster|cluster.xml#ClusterMember_2)
示例
- 使用 Jacl:
set clid [$AdminConfig getid /ServerCluster:myCluster/] set nodeid [$AdminConfig getid /Node:mynode/] $AdminConfig createClusterMember $clid $nodeid {{memberName newMem1} {weight 5}}
- 使用 Jython 字符串属性:
clid = AdminConfig.getid('/ServerCluster:myCluster/') nodeid = AdminConfig.getid('/Node:mynode/') print AdminConfig.createClusterMember(clid, nodeid, '[[memberName newMem1] [weight 5]]')
- 使用带有对象属性的 Jython:
clid = AdminConfig.getid('/ServerCluster:myCluster/') nodeid = AdminConfig.getid('/Node:mynode/') print AdminConfig.createClusterMember(clid, nodeid, [['memberName', 'newMem1'], ['weight', 5]])
createDocument
使用 createDocument 命令在配置库中创建新的文档。
目标对象
无。必需参数
- document URI
- 指定要在存储库中创建的文档的名称。
- file name
- 指定要创建的文档的有效本地文件名。
可选参数
无。示例
- 使用 Jacl:
$AdminConfig createDocument cells/mycell/myfile.xml /mydir/myfile
$AdminConfig createDocument cells/mycell/myfile.xml c:/mydir/myfile
$AdminConfig createDocument cells/mycell/myfile.xml /mydir/myfile
- 使用带有字符串属性的 Jython:
AdminConfig.createDocument('cells/mycell/myfile.xml', 'c:/mydir/myfile')
AdminConfig.createDocument('cells/mycell/myfile.xml', '/mydir/myfile')
AdminConfig.createDocument('cells/mycell/myfile.xml', '/mydir/myfile')
createUsingTemplate
使用 createUsingTemplate 命令并通过使用模板来创建具有给定父代的对象类型。只能使用此命令来创建类型为 APPLICATION_SERVER 的服务器。如果要创建 APPLICATION_SERVER 以外类型的服务器,请使用 createGenericServer 或 createWebServer 命令。
目标对象
无。必需参数
- type
- 指定要创建的对象的类型。
- parent
- 指定父代的配置标识。
- template
- 指定现有对象的配置标识。此对象可以是使用 listTemplates 命令返回的模板对象,也可以是任何其他正确类型的现有对象。
可选参数
- attributes
- 指定对象的属性值。使用此参数指定的属性将覆盖模板中的设置。
样本输出
myCluster(cells/mycell/clusters/myCluster|cluster.xml#ClusterMember_2)
示例
- 使用 Jacl:
set node [$AdminConfig getid /Node:mynode/] set templ [$AdminConfig listTemplates JDBCProvider "DB2 JDBC Provider (XA)"] $AdminConfig createUsingTemplate JDBCProvider $node {{name newdriver}} $templ
- 使用带有字符串属性的 Jython:
node = AdminConfig.getid('/Node:mynode/') templ = AdminConfig.listTemplates('JDBCProvider', "DB2 JDBC Provider (XA)") print AdminConfig.createUsingTemplate('JDBCProvider', node, '[[name newdriver]]', templ)
- 使用带有对象属性的 Jython:
node = AdminConfig.getid('/Node:mynode/') templ = AdminConfig.listTemplates('JDBCProvider', "DB2 JDBC Provider (XA)") print AdminConfig.createUsingTemplate('JDBCProvider', node, [['name', 'newdriver']], templ)
defaults
使用 defaults 命令来显示给定类型的属性的缺省值。此方法显示指定类型的对象所包含的所有可能的属性。如果属性有缺省值,此方法还显示每个属性的类型和缺省值。
目标对象
无。必需参数
- type
- 指定要返回的对象的类型。您指定的对象类型名称是基于 XML 配置文件的名称。此名称不必与管理控制台显示的名称相同。
可选参数
无。样本输出
Attribute Type Default
usingMultiRowSchema Boolean false
maxInMemorySessionCount Integer 1000
allowOverflow Boolean true
scheduleInvalidation Boolean false
writeFrequency ENUM
writeInterval Integer 120
writeContents ENUM
invalidationTimeout Integer 30
invalidationSchedule InvalidationSchedule
示例
- 使用 Jacl:
$AdminConfig defaults TuningParams
- 使用 Jython:
print AdminConfig.defaults('TuningParams')
deleteDocument
Use the deleteDocument command to delete a document from the configuration repository.
目标对象
无。必需参数
- documentURI
- 指定要从配置库中删除的文档。
可选参数
无。示例
- 使用 Jacl:
$AdminConfig deleteDocument cells/mycell/myfile.xml
- 使用 Jython:
AdminConfig.deleteDocument('cells/mycell/myfile.xml')
existsDocument
使用 existsDocument 命令来测试配置库中是否存在某个文档。
目标对象
无。必需参数
- documentURI
- 指定存储库中的要测试的文档。
可选参数
无。样本输出
1
示例
- 使用 Jacl:
$AdminConfig existsDocument cells/mycell/myfile.xml
- 使用 Jython:
print AdminConfig.existsDocument('cells/mycell/myfile.xml')
extract
使用 extract 命令来抽取由文档 URI 描述的配置库文件,并将它放在由 filename 指定的文件中。此方法仅适用于 Deployment Manager 配置。
目标对象
无。必需参数
- documentURI
- 指定要从配置库中抽取的文档。文档 URI 必须存在于存储库中。文档 URI 相对于配置库的根,例如:
/WebSphere/AppServer/config
app_server_root\config
- filename
- 指定要将文档抽取到的文件名。文件名必须是写入文档内容的有效本地文件名。如果存在由 filename 参数指定的文件,抽取的文件将替换它。
可选参数
无。样本输出
此命令将返回不透明的“摘要”对象,应将此对象用来通过使用 checkin 命令来重新检入文件。
示例
- 使用 Jacl:
set obj [$AdminConfig extract cells/MyCell/nodes/MyNode/serverindex.xml /mydir/myfile]
set obj [$AdminConfig extract cells/MyCell/nodes/MyNode/serverindex.xml c:\\mydir\myfile]
set obj [$AdminConfig extract cells/MyCell/nodes/MyNode/serverindex.xml \mydir\myfile]
- 使用 Jython:
obj = AdminConfig.extract('cells/MyCell/nodes/MyNode/serverindex.xml','/mydir/myfile')
obj = AdminConfig.extract('cells/MyCell/nodes/MyNode/serverindex.xml','c:\mydir\myfile')
obj = AdminConfig.extract('cells/MyCell/nodes/MyNode/serverindex.xml','\mydir\myfile')
getCrossDocumentValidationEnabled
使用 getCrossDocumentValidationEnabled 命令并根据当前交叉文档启用设置来返回消息。如果启用交叉文档验证,此方法返回 true。
目标对象
无。必需参数
无。
可选参数
无。
样本输出
WASX7188I: Cross-document validation enablement set to true
示例
- 使用 Jacl:
$AdminConfig getCrossDocumentValidationEnabled
- 使用 Jython:
print AdminConfig.getCrossDocumentValidationEnabled()
getid
使用 getid 命令来返回对象的配置标识。
目标对象
无。必需参数
- containment path
- 指定所需的包含路径。
可选参数
无。
样本输出
Db2JdbcDriver(cells/testcell/nodes/testnode|resources.xml#JDBCProvider_1)
示例
- 使用 Jacl:
$AdminConfig getid /Cell:testcell/Node:testNode/JDBCProvider:Db2JdbcDriver/
- 使用 Jython:
print AdminConfig.getid('/Cell:testcell/Node:testNode/JDBCProvider:Db2JdbcDriver/')
getObjectName
使用 getObjectName 命令来返回正在运行的相应 MBean 的对象名的字符串版本。如果不存在相应的运行 MBean,此方法返回空字符串。
目标对象
无。必需参数
- configuration ID
- 指定要返回的对象名的配置标识。
可选参数
无。
样本输出
WebSphere:cell=mycell,name=server1,mbeanIdentifier=cells/mycell/nodes/mynode/servers/server1/
server.xml#Server_1,type=Server,node=mynode,process=server1,processType=UnManagedProcess
示例
- 使用 Jacl:
set server [$AdminConfig getid /Node:mynode/Server:server1/] $AdminConfig getObjectName $server
- 使用 Jython:
server = AdminConfig.getid('/Node:mynode/Server:server1/') print AdminConfig.getObjectName(server)
getObjectType
使用 getObjectType 命令来显示所需对象配置标识的对象类型。
目标对象
无。必需参数
- configuration ID
- 指定要返回的对象名的配置标识。
可选参数
无。
示例
- 使用 Jacl:
set server [$AdminConfig getid /Node:mynode/Server:server1/] $AdminConfig getObjectType $server
- 使用 Jython:
server = AdminConfig.getid('/Node:mynode/Server:server1/') print AdminConfig.getObjectType(server)
getSaveMode
- overwriteOnConflict - 即使所作的更改与其他配置更改发生冲突也保存这些更改。
- rollbackOnConflict - 如果所作的更改与其他配置更改发生冲突,那么保存操作将失败。此值是缺省值。
目标对象
无。必需参数
无。
可选参数
无。
样本输出
rollbackOnConflict
示例
- 使用 Jacl:
$AdminConfig getSaveMode
- 使用 Jython:
print AdminConfig.getSaveMode()
getValidationLevel
使用 getValidationLevel 命令来返回从存储库抽取文件时所使用的验证。
目标对象
无。必需参数
无。
可选参数
无。
样本输出
WASX7189I: Validation level set to HIGH
示例
- 使用 Jacl:
$AdminConfig getValidationLevel
- 使用 Jython:
print AdminConfig.getValidationLevel()
getValidationSeverityResult
使用 getValidationSeverityResult 命令来返回最近验证中具有给定严重性的验证消息数。
目标对象
无。必需参数
- 严重性
- 指定要为其返回验证消息数的严重性级别。请指定一个 0 到 9 的整数值。
可选参数
无。
样本输出
16
示例
- 使用 Jacl:
$AdminConfig getValidationSeverityResult 1
- 使用 Jython:
print AdminConfig.getValidationSeverityResult(1)
hasChanges
使用 hasChanges 命令来确定是否存在未保存的配置更改。
目标对象
无。必需参数
无。
可选参数
无。
样本输出
1
示例
- 使用 Jacl:
$AdminConfig hasChanges
- 使用 Jython:
print AdminConfig.hasChanges()
help
使用 help 命令来显示有关 AdminConfig 对象的静态帮助信息。
目标对象
无。必需参数
无。
可选参数
无。
样本输出
WASX7053I: The AdminConfig object communicates with the configuration service in a product to manipulate
configuration data for an Application Server installation. The AdminConfig object has commands to list,
create, remove, display, and modify configuration data, as well as commands to display information about
configuration data types.
Most of the commands supported by the AdminConfig object operate in two modes: the default mode is one in which
the AdminConfig object communicates with the Application Server to accomplish its tasks. A local mode is also
possible, in which no server communication takes place. The local mode of operation is invoked by bringing up
the scripting client without a server connected using the command line "-conntype NONE" option or setting the
"com.ibm.ws.scripting.connectionType=NONE" property in the wsadmin.properties file.
The following commands are supported by the AdminConfig object; more detailed information about each of these commands is
available by using the help command of the AdminConfig object and by supplying the name of the command as an argument.
attributes Shows the attributes for a given type
checkin Checks a file into the configuration repository.
convertToCluster Converts a server to be the first member of a new server cluster
create Creates a configuration object, given a type, a parent, and a list of attributes, and
optionally an attribute name for the new object
createClusterMember Creates a new server that is a member of an existing cluster.
createDocument Creates a new document in the configuration repository.
installResourceAdapter Installs a J2C resource adapter with the given RAR file name and an option string in the node.
createUsingTemplate Creates an object using a particular template type.
defaults Displays the default values for the attributes of a given type.
deleteDocument Deletes a document from the configuration repository.
existsDocument Tests for the existence of a document in the configuration repository.
extract Extracts a file from the configuration repository.
getCrossDocumentValidationEnabled Returns true if cross-document validation is enabled.
getid Show the configuration ID of an object, given a string version of its containment
getObjectName Given a configuration ID, returns a string version of the ObjectName
for the corresponding running MBean, if any.
getSaveMode Returns the mode used when "save" is invoked
getValidationLevel Returns the validation that is used when files are extracted from the repository.
getValidationSeverityResult Returns the number of messages of a given severity from the most recent validation.
hasChanges Returns true if unsaved configuration changes exist
help Shows help information
list Lists all the configuration objects of a given type
listTemplates Lists all the available configuration templates of a given type.
modify Changes the specified attributes of a given configuration object
parents Shows the objects which contain a given type
queryChanges Returns a list of unsaved files
remove Removes the specified configuration object
required Displays the required attributes of a given type.
reset Discards the unsaved configuration changes
save Commits the unsaved changes to the configuration repository
setCrossDocumentValidationEnabled Sets the cross-document validation enabled mode.
setSaveMode Changes the mode used when "save" is invoked
setValidationLevel Sets the validation used when files are extracted from the repository.
show Shows the attributes of a given configuration object
showall Recursively shows the attributes of a given configuration
object, and all the objects that are contained within each attribute.
showAttribute Displays only the value for the single attribute that is specified.
types Shows the possible types for configuration
validate Invokes validation
示例
- 使用 Jacl:
$AdminConfig help
- 使用 Jython:
print AdminConfig.help()
installResourceAdapter
使用 installResourceAdapter 命令并使用节点中的给定资源适配器归档 (RAR) 文件名和选项字符串来安装 Java 2 连接器 (J2C) 资源适配器。当您编辑具有嵌入式 RAR 的已安装应用程序时,仅现有的 J2C 连接工厂、J2C 激活规范和 J2C 管理对象将被编辑。将不创建新的 J2C 对象。
目标对象
无。必需参数
- node
- 指定所需的节点。
- RAR file name
- 指定存放在您指定的节点中的 RAR 文件的标准文件名。
可选参数
- options
- 指定用于安装资源适配器的其他选项。有效选项包含以下选项:
- rar.name
- rar.desc
- rar.archivePath
- rar.classpath
- rar.nativePath
- rar.threadPoolAlias
- rar.propertiesSet
rar.archivePath 是将文件解压缩到的路径的名称。如果未指定此选项,那么会将此归档解压缩到 $\{CONNECTOR_INSTALL_ROOT\} 目录中。rar.classpath 选项是额外的类路径。
rar.propertiesSet 由以下内容构成:
特性的所有属性在一组 {} 中指定。一个特性在一组 {} 中指定。您可以在 {} 中指定多个属性。name String value String type String *desc String *required true/false * means the item is optional
样本输出
myResourceAdapter(cells/mycell/nodes/mynode|resources.xml#J2CResourceAdapter_1)
示例
- 使用 Jacl:
$AdminConfig installResourceAdapter /rar/mine.rar mynode{-rar.name myResourceAdapter -rar.desc "My rar file"}
$AdminConfig installResourceAdapter c:/rar/mine.rar mynode {-rar.name myResourceAdapter -rar.desc "My rar file"}
- 使用 Jython:
print AdminConfig.installResourceAdapter('/rar/mine.rar', 'mynode', '[-rar.name myResourceAdapter -rar.desc "My rar file"]')
print AdminConfig.installResourceAdapter('c:/rar/mine.rar', 'mynode', '[-rar.name myResourceAdapter -rar.desc "My rar file"]')
resourceProperties (name=myName,value=myVal)
添加到资源适配器配置中,请运行下列命令:pSet = [['propertySet',[['resourceProperties',[[['name','myName'], ['type', 'String'], ['value','myVal']]]]]]]
myRA =AdminConfig.installResourceAdapter('/query.rar','mynodeCellManager05', ['-rar.desc','mydesc'])
myRA =AdminConfig.installResourceAdapter('c:\query.rar','mynodeCellManager05', ['-rar.desc','mydesc'])
AdminConfig.modify(myRA,pSet)
list
使用 list 命令可返回一列给定类型的对象,您可通过在命令语法中指定类型和限定了作用域的父代,或者指定类型和通配符 (*) 或 Java 正则表达式 (.*) 模式来定制搜索查询,从而缩小搜索查询的范围。
目标对象
无。必需参数
- object type
- 指定对象类型的名称。对象类型的名称是一个基于 XML 配置文件的名称,并且不必与管理控制台显示的名称相同。
可选参数
- 作用域
- 使用限定了作用域的父代指定其他搜索查询信息。
- pattern
- 使用通配符 (*) 或 Java 正则表达式模式 (.*) 指定其他搜索查询信息。
样本输出
Db2JdbcDriver(cells/mycell/nodes/DefaultNode|resources.xml#JDBCProvider_1)
Db2JdbcDriver(cells/mycell/nodes/DefaultNode/servers/deploymentmgr|resources.xml#JDBCProvider_1)
Db2JdbcDriver(cells/mycell/nodes/DefaultNode/servers/nodeAgent|resources.xml#JDBCProvider_1)
示例
- 使用 Jacl:
$AdminConfig list JDBCProvider
- 使用 Jython:
print AdminConfig.list('JDBCProvider')
注: 使用单引号或双引号。
- 使用 Jacl:
$AdminConfig list JDBCProvider derby*
- 使用 Jython:
print AdminConfig.list('JDBCProvider', 'derby*')
可以使用 Java 正则表达式模式和通配符模式来指定 $AdminConfig list、types 和 listTemplates 功能的命令名。
- 使用 Jacl:
$AdminConfig list Server server1.*
- 使用 Jython:
print AdminConfig.list("Server", "server1.*")
下列示例通过指定对象类型和父作用域配置标识,列出服务器配置对象:
- 使用 Jacl:
$AdminConfig list Server myNode(cells/myCell/nodes/myNode|node.xml#Node_1)
- 使用 Jython:
print AdminConfig.list("Server", "myNode(cells/myCell/nodes/myNode|node.xml#Node_1)")
- 使用 Jacl 和 Java 正则表达式模式:
$AdminConfig types SSLConfig.*
- 使用 Jacl 和通配符模式:
$AdminConfig types SSLConfig*
- 使用 Jython 和 Java 正则表达式模式:
print AdminConfig.types("SSLConfig.*")
- 使用 Jython 和通配符模式:
print AdminConfig.types("SSLConfig*")
listTemplates
使用 listTemplates 命令来显示模板对象标识的列表。可以在命令语法中使用通配符 (*) 或 Java 正则表达式 (.*) 以定制搜索查询。
目标对象
无。必需参数
- object type
- 指定对象类型的名称。对象类型的名称是一个基于 XML 配置文件的名称,并且不必与管理控制台显示的名称相同。
- pattern
- 使用通配符或 Java 正则表达式指定其他搜索查询信息。
可选参数
无。样本输出
"Derby JDBC Provider (XA)(templates/servertypes/APPLICATION_SERVER/servers/DeveloperServer|resources.xml#builtin_jdbcprovider)"
"Derby JDBC Provider (XA)(templates/servertypes/APPLICATION_SERVER/servers/defaultZOS|resources.xml#builtin_jdbcprovider)"
"Derby JDBC Provider (XA)(templates/servertypes/APPLICATION_SERVER/servers/default|resources.xml#builtin_jdbcprovider)"
"Derby JDBC Provider (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)"
"Derby JDBC Provider 40 (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_2)"
"Derby JDBC Provider 40 Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derby_2)"
"Derby JDBC Provider 40 Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derby_1)"
"Derby JDBC Provider 40(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_1)"
"Derby JDBC Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derby_4)"
"Derby JDBC Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derby_3)"
"Derby JDBC Provider(templates/servertypes/APPLICATION_SERVER/servers/DeveloperServer|resources.xml#JDBCProvider_1124467079638)"
"Derby JDBC Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_derby_3)"
示例
- 使用 Jacl:
$AdminConfig listTemplates JDBCProvider
- 使用 Jython:
print AdminConfig.listTemplates('JDBCProvider')
- 使用 Jacl:
$AdminConfig listTemplates JDBCProvider sybase*
- 使用 Jython:
print AdminConfig.listTemplates('JDBCProvider', 'sybase*')
modify
使用 modify 命令来支持修改对象属性。
目标对象
无。必需参数
- configuration ID
- 指定要修改的对象的配置标识。
- attributes
- 指定所需的配置标识的要修改的属性。
可选参数
无。示例
- 使用 Jacl:
$AdminConfig modify ConnFactory1(cells/mycell/nodes/DefaultNode/servers/deploymentmgr|resources.xml# GenericJMSConnectionFactory_1) {{userID newID} {password newPW}}
- 使用带有字符串属性的 Jython:
AdminConfig.modify('ConnFactory1(cells/mycell/nodes/DefaultNode/servers/deploymentmgr|resources.xml# GenericJMSConnectionFactory_1)', '[[userID newID] [password newPW]]')
- 使用带有对象属性的 Jython:
AdminConfig.modify('ConnFactory1(cells/mycell/nodes/DefaultNode/servers/deploymentmgr|resources.xml# GenericJMSConnectionFactory_1)', [['userID', 'newID'], ['password', 'newPW']])
parents
使用 parents 命令来获取有关对象类型的信息。
目标对象
无。必需参数
- object type
- 指定所需的对象类型。对象类型的名称是一个基于 XML 配置文件的名称,并且不必与管理控制台显示的名称相同。
可选参数
无。样本输出
Cell
Node
Server
示例
- 使用 Jacl:
$AdminConfig parents JDBCProvider
- 使用 Jython:
print AdminConfig.parents('JDBCProvider')
queryChanges
使用 queryChanges 命令来返回未保存的配置文件的列表。
目标对象
无。必需参数
无。可选参数
无。样本输出
WASX7146I: The following configuration files contain unsaved changes:
cells/mycell/nodes/mynode/servers/server1|resources.xml
示例
- 使用 Jacl:
$AdminConfig queryChanges
- 使用 Jython:
print AdminConfig.queryChanges()
remove
使用 remove 命令来移除配置对象。
目标对象
无。必需参数
- configuration ID
- 指定所需的配置对象。
可选参数
无。示例
- 使用 Jacl:
set ds [$AdminConfig list DataSource "Default Datasource*"] $AdminConfig remove $ds
- 使用 Jython:
ds = AdminConfig.list('DataSource', 'Default Datasource*') AdminConfig.remove(ds)
required
使用 required 命令来显示特定类型的对象包含的必需属性。
目标对象
无。必需参数
- type
- 指定要显示其必需属性的对象类型。对象类型的名称是基于 XML 配置文件的名称。它不必与管理控制台显示的名称相同。
可选参数
无。样本输出
Attribute Type
streamHandlerClassName String
protocol String
示例
- 使用 Jacl:
$AdminConfig required URLProvider
- 使用 Jython:
print AdminConfig.required('URLProvider')
reset
使用 reset 命令将用于保存对配置所作更新的临时工作空间重置。
目标对象
无。必需参数
无。可选参数
无。示例
- 使用 Jacl:
$AdminConfig reset
- 使用 Jython:
AdminConfig.reset()
resetAttributes
使用 resetAttributes 命令来重置所需的配置对象的特定属性。
目标对象
无。必需参数
- configuration ID
- 指定所需的配置对象的配置标识。
- attributes
- 指定要重置的属性以及要将属性重置为的值。
可选参数
无。示例
- 使用 Jacl:
set ds [$AdminConfig list DataSource "Default Datasource*"] $AdminConfig resetAttributes $ds {{"description" "A new description for the data source"}}
- 使用 Jython:
ds = AdminConfig.list('DataSource', 'Default Datasource*') AdminConfig.resetAttributes(ds, [["description", "A new description for the data source"]])
save
使用 save 命令来保存对配置库所作的更改。
目标对象
无。必需参数
无。可选参数
无。样本输出
save 命令不会返回输出。
示例
- 使用 Jacl:
$AdminConfig save
- 使用 Jython:
AdminConfig.save()
setCrossDocumentValidationEnabled
使用 setCrossDocumentValidationEnabled 命令来设置支持交叉文档验证的方式。值为 true 或 false.
目标对象
无。必需参数
- flag
- 指定是启用还是禁用了交叉文档验证。指定 true 就会启用交叉文档验证,指定 false 就会禁用交叉文档验证。
可选参数
无。样本输出
WASX7188I: Cross-document validation enablement set to true
示例
- 使用 Jacl:
$AdminConfig setCrossDocumentValidationEnabled true
- 使用 Jython:
print AdminConfig.setCrossDocumentValidationEnabled('true')
setSaveMode
使用 setSaveMode 命令来修改 save 命令的行为。
目标对象
无。必需参数
- save mode
- 指定要使用的保存方式。缺省值为 rollbackOnConflict。如果系统在进行保存时发现冲突,就不会落实未保存的更改。备用值是 overwriteOnConflict,它将更改保存到配置库,即使有冲突也一样。要将 overwriteOnConflict 作为此命令的值使用,必须为配置覆盖启用 Deployment Manager。
可选参数
无。样本输出
setSaveMode 命令不会返回输出。
示例
- 使用 Jacl:
$AdminConfig setSaveMode overwriteOnConflict
- 使用 Jython:
AdminConfig.setSaveMode('overwriteOnConflict')
setValidationLevel
使用 setValidationLevel 命令来设置从存储库中抽取文件时所使用的验证。
目标对象
无。必需参数
- level
- 指定要使用的验证。可以使用五个验证级别:none、low、medium、high 或 highest。
可选参数
无。样本输出
WASX7189I: Validation level set to HIGH
示例
- 使用 Jacl:
$AdminConfig setValidationLevel high
- 使用 Jython:
print AdminConfig.setValidationLevel('high')
show
使用 show 命令来返回给定对象的顶级属性。
目标对象
无。必需参数
- configuration ID
- 指定所需的对象的配置标识。
可选参数
无。样本输出
[name "Sample Datasource"] [description "Data source for the Sample entity beans"]
示例
- 使用 Jacl:
$AdminConfig show Db2JdbcDriver(cells/mycell/nodes/DefaultNode|resources.xmlJDBCProvider_1)
- 使用 Jython:
print AdminConfig.show('Db2JdbcDriver(cells/mycell/nodes/DefaultNode|resources.xmlJDBCProvider_1)')
showall
使用 showall 命令来递归地显示给定配置对象的属性。
目标对象
无。必需参数
- configuration ID
- 指定所需的对象的配置标识。
可选参数
无。样本输出
此命令返回一个包含属性值的字符串,如以下示例所示:
tcpNoDelay: null
SoTimeout: 0
bytesRead: 6669
{authMechanismPreference BASIC_PASSWORD}
{connectionPool {{agedTimeout 0}
{connectionTimeout 180}
{freePoolDistributionTableSize 0}
{maxConnections 10}
{minConnections 1}
{numberOfFreePoolPartitions 0}
{numberOfSharedPoolPartitions 0}
{numberOfUnsharedPoolPartitions 0}
{properties {}}
{purgePolicy EntirePool}
{reapTime 180}
{stuckThreshold 0}
{stuckTime 0}
{stuckTimerTime 0}
{surgeCreationInterval 0}
{surgeThreshold -1}
{testConnection false}
{testConnectionInterval 0}
{unusedTimeout 1800}}}
{datasourceHelperClassname com.ibm.websphere.rsadapter.DerbyDataStoreHelper}
{description "Datasource for the WebSphere Default Application"}
{diagnoseConnectionUsage false}
{jndiName DefaultDatasource}
{logMissingTransactionContext true}
{manageCachedHandles false}
{name "Default Datasource"}
{properties {}}
{propertySet {{resourceProperties {{{name databaseName}
{required false}
{type java.lang.String}
{value ${APP_INSTALL_ROOT}/${CELL}/DefaultApplication.ear/DefaultDB}} {{name shu
tdownDatabase}
{required false}
{type java.lang.String}
{value {}}} {{name dataSourceName}
{required false}
{type java.lang.String}
{value {}}} {{name description}
{required false}
{type java.lang.String}
{value {}}} {{name connectionAttributes}
{required false}
{type java.lang.String}
{value upgrade=true}} {{name createDatabase}
{required false}
{type java.lang.String}
{value {}}}}}}}
{provider "Derby JDBC Provider(cells/isthmusCell04/nodes/isthmusNode14/servers/s
erver1|resources.xml#JDBCProvider_1183122153343)"}
{providerType "Derby JDBC Provider"}
{relationalResourceAdapter "WebSphere Relational Resource Adapter(cells/isthmusC
ell04/nodes/isthmusNode14/servers/server1|resources.xml#builtin_rra)"}
{statementCacheSize 10}
[datasourceHelperClassname com.ibm.websphere.rsadapter.DerbyDataStoreHelper]
[description "Datasource for the WebSphere Default Application"]
[jndiName DefaultDatasource]
[name "Default Datasource"]
[propertySet [[resourceProperties [[[description "Location of Apache Derby default database."]
[name databaseName]
[type string]
[value ${WAS_INSTALL_ROOT}/bin/DefaultDB]] [[name remoteDataSourceProtocol]
[type string]
[value []]] [[name shutdownDatabase]
[type string]
[value []]] [[name dataSourceName]
[type string]
[value []]] [[name description]
[type string]
[value []]] [[name connectionAttributes]
[type string]
[value []]] [[name createDatabase]
[type string]
[value []]]]]]]
[provider "Apache Derby JDBC Driver(cells/pongo/nodes/pongo/servers/server1|resources.xml#JDBCProvider_1)"]
[relationalResourceAdapter "WebSphere Relational Resource Adapter(cells/pongo/nodes/pongo/servers/server1|
resources.xml#builtin_rra)"]
[statementCacheSize 0]
您可能必须将 Jython 输出从字符串转换为列表,以便进行进一步处理。示例
- 使用 Jacl:
$AdminConfig showall "Default Datasource(cells/mycell/nodes/DefaultNode/servers/server1:resources.xml#DataSource_1)"
- 使用 Jython:
print AdminConfig.showall ("Default Datasource(cells/mycell/nodes/DefaultNode/servers/server1:resources.xml#DataSource_1)")
showAttribute
使用 showAttribute 命令来仅显示您指定的单个属性的值。
目标对象
无。必需参数
- configuration ID
- 指定所需的对象的配置标识。
- attribute
- 指定要查询的属性。
可选参数
无。样本输出
mynode
示例
- 使用 Jacl:
set ns [$AdminConfig getid /Node:mynode/] $AdminConfig showAttribute $ns hostName
- 使用 Jython:
ns = AdminConfig.getid('/Node:mynode/') print AdminConfig.showAttribute(ns, 'hostName')
在 V7.0.0.5 之前的版本中,Jython 脚本编制语言无法识别特殊字符。此外,当属性参数之间存在逗号和单个空格字符时,这些字符将被当作定界符,并且在保存属性值时将忽略这些字符。例如,您可能发出以下 Jython 命令集:
您可以使用以下命令来显示值:value='{"param1","param2"}' serverId=AdminConfig.getid('/Cell:cell_name/Node:node_name/Server:server_name') nameSpace=AdminConfig.create('StringNameSpaceBinding',serverId,[['name','TestName'], ['nameInSpace','TestNameSpace'],['stringToBind',value] ])
此命令将生成以下输出:print AdminConfig.showAttribute(nameSpace, 'stringToBind')
在 V7.0.0.5 及更高版本中,Jython 脚本编制语言可以识别逗号(在其前面附加有一个反斜杠字符(\) 的情况下)。例如,在 Jython 命令的原始示例集中,将第一行更改为以下命令:{"param1" "param2"}
当显示值时,返回以下输出:value='{"param1"\,"param2"}'
{"param1","param2"}
类型
使用 types 命令可返回您可以处理的一列配置对象类型,通过在命令语法中指定附加的通配符 (*) 或 Java 正则表达式 (.*) 模式,可对搜索查询进行定制。
目标对象
无。必需参数
无。可选参数
- pattern
- 使用通配符 (*) 或 Java 正则表达式模式 (.*) 指定其他搜索查询信息。
样本输出
AdminService
Agent
ApplicationConfig
ApplicationDeployment
ApplicationServer
AuthMechanism
AuthenticationTarget
AuthorizationConfig
AuthorizationProvider
AuthorizationTableImpl
BackupCluster
CMPConnectionFactory
CORBAObjectNameSpaceBinding
Cell
CellManager
Classloader
ClusterMember
ClusteredTarget
CommonSecureInteropComponent
示例
- 使用 Jacl:
$AdminConfig types
- 使用 Jython:
print AdminConfig.types()
- 使用 Jacl:
$AdminConfig types *security*
- 使用 Jython:
print AdminConfig.types('*security*')
uninstallResourceAdapter
使用 uninstallResourceAdapter 命令并使用给定的 J2C 资源适配器配置标识和选项列表来卸载 Java 2 连接器 (J2C) 资源适配器。当您从配置库移除 J2CResourceAdapter 对象时,已安装的目录在同步时将被移除。停止请求将被发送到已被移除的 J2CResourceAdapter MBean。
目标对象
无。必需参数
- configuration ID
- 指定要移除的资源适配器的配置标识。
可选参数
- options list
- 指定命令的卸载选项。有效选项为 force。此选项在不检查资源适配器是否被应用程序使用的情况下,强制卸载资源适配器。使用它的应用程序将不会卸载。如果您不指定 force 选项,并且指定的资源适配器仍在使用,那么不卸载资源适配器。
样本输出
WASX7397I: The following J2CResourceAdapter objects are removed:
MyJ2CRA(cells/juniarti/nodes/juniarti|resources.xml#J2CResourceAdapter_1069433028609)
示例
- 使用 Jacl:
set j2cra [$AdminConfig getid /J2CResourceAdapter:MyJ2CRA/] $AdminConfig uninstallResourceAdapter $j2cra {-force}
- 使用 Jython:
j2cra = AdminConfig.getid('/J2CResourceAdapter:MyJ2CRA/') print AdminConfig.uninstallResourceAdapter(j2cra, '[-force]')
unsetAttributes
使用 unsetAttributes 命令将配置对象的特定属性重置为缺省值。
目标对象
无。必需参数
- configuration ID
- 指定所需的配置对象的配置标识。
- attributes
- 指定要重置为缺省值的属性。
可选参数
无。示例
- 使用 Jacl:
set cluster [$AdminConfig getid /ServerCluster:myCluster] $AdminConfig unsetAttributes $cluster {"enableHA", "preferLocal"}
- 使用 Jython:
cluster = AdminConfig.getid("/ServerCluster:myCluster") AdminConfig.unsetAttributes(cluster, ["enableHA", "preferLocal"])
validate
使用 validate 命令并根据您工作空间中的文件、支持交叉文档验证的标志的值以及验证级别设置来请求配置验证结果。可以选择指定配置标识以设置作用域。如果您指定配置标识,那么此请求的作用域是由 configuration ID 参数指定的对象。
目标对象
无。必需参数
无。可选参数
- configuration ID
- 指定所需的对象的配置标识。
样本输出
WASX7193I: Validation results are logged in c:\WebSphere5\AppServer\logs\wsadmin.valout: Total number of messages: 16
WASX7194I: Number of messages of severity 1: 16
示例
- 使用 Jacl:
$AdminConfig validate
- 使用 Jython:
print AdminConfig.validate()