使用 wsadmin Scripting 的 AdminConfig 物件指令
使用 AdminConfig 物件來呼叫配置指令,以及建立或變更 WebSphere® Application Server 配置 (例如,建立資料來源) 的元素。
如果您只想使用本端作業,則可以在沒有執行中伺服器的情況下啟動 Scripting 用戶端。 如果要以本端模式執行,請使用 -conntype NONE 選項來啟動 Scripting 用戶端。 您會收到一則指出您正在執行本端模式的訊息。 如果伺服器在執行中,請勿以本端模式執行 AdminConfig 工具。 在本端模式下所做的配置變更不會反映在執行中伺服器配置中。 如果您儲存衝突的配置,可能會毀損配置。
params='[[name name1] [nameInNameSpace nameSpace_Name] [string_to_bind "value, withComma"]]'
AdminConfig.create(type, parent, params)您也可以使用 modify 指令:AdminConfig.modify(type, params)- 屬性
- checkin
- convertToCluster
- create
- createClusterMember
- createDocument
- createUsingTemplate
- defaults
- deleteDocument
- existsDocument
- 擷取
- getCrossDocumentValidationEnabled
- getid
- getObjectName
- getObjectType
- getSaveMode
- getValidationLevel
- getValidationSeverityResult
- hasChanges
- 說明
- installResourceAdapter
- list
- listTemplates
- modify
- parents
- queryChanges
- 移除
- 驗證表示式
- 重設
- resetAttributes
- save
- setCrossDocumentValidationEnabled
- setSaveMode
- setValidationLevel
- show
- showall
- showAttribute
- 類型
- uninstallResourceAdapter
- unsetAttributes
- validate
屬性
使用 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) 所說明的配置儲存庫中。 此方法僅適用於部署管理程式配置。
目標物件
無。必要參數
- URI
- 文件 URI 是相對於配置儲存庫的根目錄,例如:
app_server_root\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 - 使用 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)
convertToCluster
請使用 convertToCluster 指令來轉換伺服器,使它成為新伺服器叢集的第一個成員。
目標物件
無。必要參數
- 伺服器 ID
- 相關伺服器的配置 ID。
- 叢集名稱
- 指定相關叢集的名稱。
選用參數
無。範例輸出
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
- 指定母項物件的配置 ID。
- 屬性
- 指定要新增到配置 ID 的任何屬性。
選用參數
無。範例輸出
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 String 屬性:
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 參數所指定的屬性。 伺服器是使用範本 ID 屬性指定的伺服器範本來建立,且包含 memberName 屬性指定的名稱。 memberName 屬性是必要的。 範本選項只適用於您建立的第一個叢集成員。 您在第一個成員之後建立的所有叢集成員都相同。
目標物件
無。必要參數
- cluster ID
- 指定相關叢集的配置 ID。
- node ID
- 指定相關節點的配置 ID。
- template ID
- 指定用來建立伺服器的範本 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 String 屬性:
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 - 搭配字串屬性使用 Jython:
AdminConfig.createDocument('cells/mycell/myfile.xml', 'c:/mydir/myfile')AdminConfig.createDocument('cells/mycell/myfile.xml', '/mydir/myfile')
createUsingTemplate
使用 createUsingTemplate 指令,利用範本來建立具有給定母項的物件類型。 您只能使用這個指令來建立具有 APPLICATION_SERVER 類型的伺服器。 如果您要建立非 APPLICATION_SERVER 類型的伺服器,請使用 createGenericServer 或 createWebServer 指令。
目標物件
無。必要參數
- type
- 指定要建立的物件類型。
- parent
- 指定母項的配置 ID。
- 範本 (template)
- 指定現有物件的配置 ID。 這個物件可以是利用 listTemplates 指令傳回的範本物件,或任何其他正確類型的現有物件。
選用參數
- 屬性
- 指定物件的屬性值。 使用此參數指定的屬性會置換範本中的設定。
範例輸出
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
請使用 deleteDocument 指令,從配置儲存庫中刪除文件。
目標物件
無。必要參數
- 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 指令來擷取文件 URI 所說明的配置儲存庫檔案,放在 filename 所指名的檔案中。 此方法僅適用於部署管理程式配置。
目標物件
無。必要參數
- documentURI
- 指定要從配置儲存庫中擷取的文件。 文件 URI 必須在儲存庫中。 文件 URI 是相對於配置儲存庫的根目錄,例如:
/WebSphere/AppServer/config
app_server_root\config
- filename
- 指定文件擷取後的檔名。 這個檔名必須是文件內容寫入其中的有效本端檔名。 如果 filename 參數所指定的檔案存在,解壓縮的檔案會取代它。
選用參數
無。範例輸出
指令會傳回不透明的 "digest" 物件,應使用 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] - 使用 Jython:
obj = AdminConfig.extract('cells/MyCell/nodes/MyNode/serverindex.xml','/mydir/myfile')obj = AdminConfig.extract('cells/MyCell/nodes/MyNode/serverindex.xml','c:\mydir\myfile')
getCrossDocumentValidationEnabled
請使用 getCrossDocumentValidationEnabled 指令來傳回訊息,其含現行跨文件啟用設定。 如果跨文件啟用驗證,這個方法會傳回 true。
目標物件
無。必要參數
無。
選用參數
無。
範例輸出
WASX7188I: Cross-document validation enablement set to true範例
- 使用 Jacl:
$AdminConfig getCrossDocumentValidationEnabled - 使用 Jython:
print AdminConfig.getCrossDocumentValidationEnabled()
getid
請使用 getid 指令來傳回物件的配置 ID。
目標物件
無。必要參數
- 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
- 指定要傳回之物件名稱的配置 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 指令來顯示相關物件配置 ID 的物件類型。
目標物件
無。必要參數
- configuration ID
- 指定要傳回之物件名稱的配置 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,如果沒有未儲存的配置變更,便傳回 0,如下列範例所示:1範例
- 使用 Jacl:
$AdminConfig hasChanges - 使用 Jython:
print AdminConfig.hasChanges()
說明
請使用 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 Connector (J2C) 資源配接器。 當您使用內嵌 RAR 來編輯已安裝的應用程式時,只會編輯現有的 J2C Connection Factory、 J2C 啟動規格及 J2C 管理物件。 不會建立新的 J2C 物件。
目標物件
無。必要參數
- 節點
- 指定相關的節點。
- RAR file name
- 指定在所指定節點上 RAR 檔案的完整檔名。
選用參數
- 選項
- 指定用來安裝資源配接器的其他選項。 有效選項包括下列選項:
rar.namerar.descrar.archivePathrar.classpathrar.nativePathrar.threadPoolAliasrar.propertiesSet
rar.desc選項是 J2CResourceAdapter 的說明。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 配置檔為基礎,不需要是管理主控台所顯示的相同名稱。
選用參數
- scope
- 使用限定範圍的母項來指定其他搜尋查詢資訊。
- 型樣
- 使用萬用字元 (*) 或 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 清單、類型和 listTemplates 函數的指令名稱。
server1 字串開頭的物件類型和 Java 表示式型樣,來列出伺服器配置物件:- 使用 Jacl:
$AdminConfig list Server server1.* - 使用 Jython:
print AdminConfig.list("Server", "server1.*")
下列範例提供物件類型和母項範圍配置 ID 來列出伺服器配置物件:
- 使用 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)")
SSLConfig 開頭的每個找到的配置物件:- 使用 Jacl 和一般 Java 表示式型樣:
$AdminConfig types SSLConfig.* - 使用 Jacl 和萬用字元型樣:
$AdminConfig types SSLConfig* - 使用 Jython 和一般 Java 表示式型樣:
print AdminConfig.types("SSLConfig.*") - 使用 Jython 和萬用字元型樣:
print AdminConfig.types("SSLConfig*")
listTemplates
請利用 listTemplates 指令來顯示範本物件 ID 清單。 您可以利用指令語法中的萬用字元 (*) 或 Java 正規表示式 (.*) 來自訂搜尋查詢。
目標物件
無。必要參數
- object type
- 指定物件類型的名稱。 物件類型的名稱是以 XML 配置檔為基礎,不需要是管理主控台所顯示的相同名稱。
- 型樣
- 使用萬用字元或 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')
sybase 字串開頭的 JDBC 提供者範本:- 使用 Jacl:
$AdminConfig listTemplates JDBCProvider sybase* - 使用 Jython:
print AdminConfig.listTemplates('JDBCProvider', 'sybase*')
modify
請使用 modify 指令來支援修改物件屬性。
目標物件
無。必要參數
- configuration ID
- 指定要修改之物件的配置 ID。
- 屬性
- 指定要針對相關配置 ID 來修改的屬性。
選用參數
無。範例
- 使用 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 指令來移除配置物件。
目標物件
無。必要參數
- configuration ID
- 指定相關的配置物件。
選用參數
無。範例
- 使用 Jacl:
set ds [$AdminConfig list DataSource "Default Datasource*"] $AdminConfig remove $ds - 使用 Jython:
ds = AdminConfig.list('DataSource', 'Default Datasource*') AdminConfig.remove(ds)
驗證表示式
請使用 required 指令來顯示特定類型的物件所包含的必要屬性。
目標物件
無。必要參數
- type
- 指定要顯示必要屬性的物件類型。 物件類型的名稱是以 XML 配置檔為基礎。 它不需要與管理主控台所顯示的名稱相同。
選用參數
無。範例輸出
Attribute Type
streamHandlerClassName String
protocol String範例
- 使用 Jacl:
$AdminConfig required URLProvider - 使用 Jython:
print AdminConfig.required('URLProvider')
重設
請使用 reset 指令來重設暫時工作區,該區保留配置更新。
目標物件
無。必要參數
無。選用參數
無。範例
- 使用 Jacl:
$AdminConfig reset - 使用 Jython:
AdminConfig.reset()
resetAttributes
請利用 resetAttributes 指令來重設相關配置物件的特定屬性。
目標物件
無。必要參數
- configuration ID
- 指定相關配置物件的配置 ID。
- 屬性
- 指定要重設的屬性,以及屬性要重設的值。
選用參數
無。範例
- 使用 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作為這個指令的值,就必須啟用部署管理程式的配置改寫功能。
選用參數
無。範例輸出
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
- 指定相關物件的配置 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
- 指定相關物件的配置 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
- 指定相關物件的配置 ID。
- 屬性
- 指定要查詢的屬性。
選用參數
無。範例輸出
mynode範例
- 使用 Jacl:
set ns [$AdminConfig getid /Node:mynode/] $AdminConfig showAttribute $ns hostName - 使用 Jython:
ns = AdminConfig.getid('/Node:mynode/') print AdminConfig.showAttribute(ns, 'hostName')在 7.0.0.5版之前, Jython Scripting 語言無法辨識特殊字元。 此外,當屬性參數之間出現逗點及單一空格字元時,會將這些字元視為刪除字元,並在儲存屬性值時予以忽略。 比方說,您可能會有下面這一組 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')
在 7.0.0.5 版以及更新版本中,若在逗點之前加上反斜線字元 (\) ,則 Jython Scripting 語言可辨識逗點。 例如,在 Jython 指令的原始範例集中,將第一行變更為下列指令:{"param1" "param2"}
當您列印值時,會傳回下列輸出:value='{"param1"\,"param2"}'{"param1","param2"}
類型
使用 types 指令,在指令語法中提供其他萬用字元 (*) 或 Java 正規表示式 (. *) 型樣,以傳回您可以操作或自訂搜尋查詢的配置物件類型清單。
目標物件
無。必要參數
無。選用參數
- 型樣
- 使用萬用字元 (*) 或 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()
security 字串型樣的每一個物件類型:- 使用 Jacl:
$AdminConfig types *security* - 使用 Jython:
print AdminConfig.types('*security*')
uninstallResourceAdapter
請使用 uninstallResourceAdapter 指令,以給定的 Java 2 Connector (J2C) 資源配接器配置 ID 和選項清單來解除安裝 J2C 資源配接器。 當您從配置儲存庫移除 J2CResourceAdapter 物件時,會在同步化時移除已安裝的目錄。 停止要求會傳送至已移除的 J2CResourceAdapter MBean。
目標物件
無。必要參數
- configuration ID
- 指定要移除之資源配接器的配置 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
- 指定相關配置物件的配置 ID。
- 屬性
- 指定屬性來重設為預設值。
選用參數
無。範例
- 使用 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 指令,根據工作區中的檔案、跨文件驗證啟用旗標值及驗證層次設定來要求配置驗證結果。 (選用)您可以指定一個配置 ID 來設定範圍。 如果您指定配置 ID,這個要求的範圍就是配置 ID 參數所指名的物件。
目標物件
無。必要參數
無。選用參數
- configuration ID
- 指定相關物件的配置 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()