The AdminConfig object for scripted administration

Use the AdminConfig object to invoke configuration commands and to create or change elements of the WebSphere Application Server configuration.

You can start the scripting client without a running server, if you only want to use local operations. To run in local mode, use the -conntype NONE option to start the scripting client. You will receive a message that you are running in the local mode. If an application server is running, it is recommended that you do not run the AdminConfig tool in local mode.

The following public methods are available for the AdminConfig object:

attributes
Returns a list of the top level attributes for a given type.

Note: The name of the object type that you input here is based on the XML configuration files and does not need to be the same name that the administrative console displays.

Parameters: object type

Example usage:

$AdminConfig attributes ApplicationServer

Example output:

"properties Property*" "serverSecurity ServerSecurity" "server Server@" "id Long" 
"stateManagement StateManageable" "name String" "moduleVisibility
EEnumLiteral(MODULE, COMPATIBILITY, SERVER, APPLICATION)" 
"services Service*" "statisticsProvider StatisticsProvider"

checkin
Checks a file in to the configuration repository. The file is described by the document URI.

Note: This method only applies to deployment manager configurations.

Parameters: document URI, filename, opaque object

Example usage:

$AdminConfig checkin cells/MyCell/Node/MyNode/serverindex.xml 
  /home/mydir/myfile $obj

The document URI is relative to the root of the configuration repository (/QIBM/UserData/WebAS5/edition/instance/config, where edition is Base for WebSphere Application Server and ND for WebSphere Application Server Network Deployment, and instance is the name of your application server instance). The file specified by the filename parameter is used as the source of the file to check in. The opaque object is an object that the extract command of the AdminConfig object returns by a prior call.

contents
Obtains information about object types.

Note: The name of the object type that you input here is the one based on the XML configuration files and does not have to be the same name that the administrative console displays.

Parameters: object type

Example usage:

$AdminConfig contents JDBCProvider

Example output:

{DataSource DataSource}
{WAS40DataSource WAS40DataSource}

convertToCluster
Converts a server so that it is the first member of a new ServerCluster.

Arguments: server id, cluster name

Example usage:

set serverid [$AdminConfig getid /Server:myServer/]
   $AdminConfig convertToCluster $serverid myCluster

Example output:

myCluster(cells/mycell/clusters/myCluster:cluster.xml#ClusterMember_2

create
Creates configuration objects.

Note: The name of the object type that you input here is the one based on the XML configuration files. It does not have to be the same name that the administrative console displays.

Parameters: type, parent ID, attributes

Example usage:

set jdbc1 [$AdminConfig getid /JDBCProvider:jdbc1/]
$AdminConfig create DataSource $jdbc1 {{name ds1}}

Example output:

ds1(cells/mycell/nodes/DefaultNode/servers/server1:resources.xml#DataSource_6)

createClusterMember
Creates a new server as a member of an existing cluster.

This method creates a new server object on the node that the node id argument specifies. This server is created as a new member of the existing cluster specified by the cluster id argument, and contains attributes specified in the member attributes argument. The server is created using the server template specified by the template id attribute, and contains the name specified by the memberName attribute. The memberName attribute is required.

Arguments: cluster id, node id, member attributes

Note: The name of the object type that you specify here is the one based on the XML configuration files. It does not need to be the same name that the administrative console displays.

Example usage:

set clid [$AdminConfig getid /ServerCluster:myCluster/]
set nodeid [$AdminConfig getid /Node:mynode/]
set template [$AdminConfig getid /Node:mynode/Server:myServer/]
$AdminConfig createClusterMember $clid $nodeid {{memberName newMem1} {weight 5
$template

Example output:

myCluster(cells/mycell/clusters/myCluster:cluster.xml#ClusterMember_2)

createDocument
Creates a new document in the configuration repository.

The documentURI argument names the document to create in the repository. The filename argument must be a valid local file name where the contents of the document exist.

Parameters: documentURI, filename

Example usage:

$AdminConfig createDocument cells/mycell/myfile.xml /home/mydir/myfile

createUsingTemplate
Creates a type of object with the given parent, using a template.

Parameters: type, parent id, attributes, template ID

Example usage:

set node [$AdminConfig getid /Node:mynode/]
set templ [$AdminConfig listTemplates JDBCProvider "DB2 JDBC Provider (XA)"]
$AdminConfig createUsingTemplate JDBCProvider $node {{name newdriver}} $templ

defaults
Displays the default values for attributes of a given type.

This method displays all of the possible attributes contained by an object of a specific type. If the attribute has a default value, this method also displays the type and default value for each attribute.

Note: The name of the object type that you input here is the one based on the XML configuration files. It does not have to be the same name that the administrative console displays.

Parameters: type

Example usage:

$AdminConfig defaults TuningParams

Example output:

 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

deleteDocument
Deletes a document from the configuration repository.

The documentURI argument names the document that will be deleted from the repository.

Parameters: documentURI

Example usage:

$AdminConfig deleteDocument cells/mycell/myfile.xml

existsDocument
Tests for the existence of a document in the configuration repository.

The documentURI argument names the document to test in the repository.

Parameters: documentURI

Example usage:

$AdminConfig existsDocument cells/mycell/myfile.xml

Example output:

1

extract
Extracts a configuration repository file described by document URI and places it in the file named by filename.

Note: This method only applies to deployment manager configurations.

Parameters: document URI, filename

Example usage:

set obj [$AdminConfig extract cells/MyCell/Node/MyNode/serverindex.xml 
  /home/mydir/myfile]

The document URI is relative to the root of the configuration repository (/QIBM/UserData/WebAS5/edition/instance/config, where edition is Base for WebSphere Application Server and ND for WebSphere Application Server Network Deployment, and instance is the name of your application server instance). If the file specified by filename exists, the extracted file replaces it.

getCrossDocumentValidationEnabled
Returns a message with the current cross-document enablement setting.

This method returns true if cross-document validation is enabled.

Parameters: none

Example usage:

$AdminConfig getCrossDocumentValidationEnabled

Example output:

WASX7188I: Cross-document validation enablement set to true

getid
Returns the configuration id of an object.

Parameters: containment path

Example usage:

$AdminConfig getid /Cell:testcell/Node:testNode/JDBCProvider:Db2JdbcDriver/

Example output:

Db2JdbcDriver(cells/testcell/nodes/testnode/resources.xml#JDBCProvider_1)

getObjectName
Returns a string version of the object name for the corresponding running MBean.

This method returns an empty string if there is no corresponding running MBean.

Parameters: configuration id

Example usage:

set server [$AdminConfig getid /Node:mynode/Server:server1/]
$AdminConfig getObjectName $server

Example output:

WebSphere:cell=mycell,
name=server1,mbeanIdentifier=cells/mycell/nodes/mynode/servers/
server1/server.xml#Server_1,type=Server,node=mynode,process=server1,
processType=UnManagedProcess

getSaveMode
Returns the mode used when you invoke a save command.

Possible values include the following:

Parameters: none

Example usage:

$AdminConfig getSaveMode

Example output:

rollbackOnConflict

getValidationLevel
Returns the validation used when files are extracted from the repository.

Parameters: none

Example usage:

$AdminConfig getValidationLevel

Example output:

WASX7189I: Validation level set to HIGH

getValidationSeverityResult
Returns the number of validation messages with the given severity from the most recent validation.

Parameters: severity

Example usage:

$AdminConfig getValidationSeverityResult 1

Example output:

16

hasChanges
Returns true if unsaved configuration changes exist.

Parameters: none

Example usage:

$AdminConfig hasChanges

Example output:

1

help
Displays static help information for the AdminConfig object.

Parameters: none

Usage:

$AdminConfig help

Output:

WASX7053I: The AdminConfig object communicates with the
Config Service in a WebSphere server to manipulate configuration data
for a WebSphere installation.  AdminConfig 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 AdminConfig operate in two modes:
the default mode is one in which AdminConfig communicates with the
WebSphere 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 with
no server connected using the command line "-conntype NONE" option
or setting the "com.ibm.ws.scripting.connectionType=NONE" property in
the wsadmin.properties.

The following commands are supported by AdminConfig; more detailed
information about each of these commands is available by using the
"help" command of AdminConfig and supplying the name of the command
as an argument.

attributes      Show the attributes for a given type
checkin         Check a file into the the config repository.
convertToCluster
                converts a server to be the first member of a
                new ServerCluster
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 config 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 attributes of a given type.
deleteDocument  Deletes a document from the config repository.
existsDocument  Tests for the existence of a document in the config repository.
extract         Extract a file from the config repository.
getCrossDocumentValidationEnabled
                Returns true if cross-document validation is enabled.
getid           Show the configId of an object, given a string version of
                its containment
getObjectName   Given a config id, return 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 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            Show help information
list            Lists all configuration objects of a given type
listTemplates   Lists all available configuration templates of a given
                type.
modify          Change specified attributes of a given configuration object
parents         Show 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           Discard unsaved configuration changes
save            Commit 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            Show the attributes of a given configuration object
showall         Recursively show the attributes of a given configuration
                object, and all the objects contained within each attribute.
showAttribute   Displays only the value for the single attribute specified.
types           Show the possible types for configuration
validate        Invokes validation

installResourceAdapter
Installs a J2C resource adapter with the given RAR file name and an option string in the node.

The RAR file name is the fully qualified file name that resides in the node that you specify. The valid options include the following:

All options are optional. The rar.name option is the name for the J2CResourceAdapter. If you do not specify this option, the display name in the rar deployment descriptor is used. If that is not specified, the RAR file name is used. The rar.desc option is a description of the J2CResourceAdapter. The rar.archivePath is the name of the path where the file is to be extracted. If you do not specify this option, the archive will be extracted to the $\{CONNECTOR_INSTALL_ROOT\} directory. The rar.classpath is the additional class path.

Parameters: rar file name, node, options

Example usage:

$AdminConfig installResourceAdapter /rar/mine.rar {-rar.name myResourceAdapter 
  -rar.desc "My rar file"} mynode

Example output:

myResourceAdapter(cells/mycell/nodes/mynode:resources.xml#J2CResourceAdapter_1)

list
Returns a list of objects of a given type, possibly scoped by a parent.

Note: The name of the object type that you input here is the one based on the XML configuration files and does not have to be the same name that the administrative console displays.

Parameters: object type

Example usage:

$AdminConfig list JDBCProvider

Example output:

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)

listTemplates
Displays a list of template object IDs.

Parameters: object type

Example usage:

$AdminConfig listTemplates JDBCProvider

This example displays a list of all JDBCProvider templates available on the system.

modify
Supports modification of object attributes.

Parameters: object, attributes

Example usage:

$AdminConfig modify
ConnFactory1(cells/mycell/nodes/DefaultNode/servers/deploymentmgr/resources.xml
#GenericJMSConnectionFactory_1) {{userID newID} {password newPW}}

parents
Obtains information about object types.

Note: The name of the object type that you input here is the one based on the XML configuration files and does not have to be the same name that the administrative console displays.

Parameters: object type

Example usage:

$AdminConfig parents JDBCProvider

Example output:

Cell
Node
Server

queryChanges
Returns a list of unsaved configuration files.

Parameters: none

Example usage:

$AdminConfig queryChanges

Example output:

WASX7146I: The following configuration files contain unsaved changes:
cells/mycell/nodes/mynode/servers/server1/resources.xml

remove
Removes a configuration object.

Parameters: object

Example usage:

$AdminConfig remove ds1(cells/mycell/nodes/DefaultNode/servers/server1:
  resources.xml#DataSource_6)

required
Displays the required attributes contained by an object of a certain type.

Note: The name of the object type that you input here is the one based on the XML configuration files. It does not have to be the same name that the administrative console displays.

Parameters: object

Example usage:

$AdminConfig required URLProvider

Example output:

Attribute                       Type
streamHandlerClassName          String
protocol                        String

reset
Resets the temporary workspace that holds updates to the configuration.

Parameters: none

Example usage:

$AdminConfig reset

save
Saves changes in the configuration repository.

Parameters: none

Example usage:

$AdminConfig save

setCrossDocumentValidationEnabled
Sets the cross-document validation enabled mode. Values include true or false.

Parameters: flag

Example usage:

$AdminConfig setCrossDocumentValidationEnabled true

setSaveMode
Allows you to toggle the behavior of the save command. The default is rollbackOnConflict. When a conflict is discovered while saving, the unsaved changes are not committed. The alternative is overwriteOnConflict which saves the changes to the configuration repository even if there are conflicts.

Parameters: mode

Example usage:

$AdminConfig setSaveMode overwriteOnConflict

setValidationLevel
Sets the validation used when files are extracted from the repository.

There are five validation levels: none, low, medium, high, or highest.

Parameters: level

Example usage:

$AdminConfig setValidationLevel high

Example output:

WASX7189I: Validation level set to HIGH

show
Returns the top level attributes of the given object.

Parameters: object, attributes

Example usage:

$AdminConfig show Db2JdbcDriver(cells/mycell/nodes/DefaultNode/
  resources.xm#JDBCProvider_1)

Example output:

{name "Sample Datasource"} {description "Data source for the Sample entity beans"} 

showall
Recursively shows the attributes of a given configuration object.

Parameters: object, attributes

Example usage:

$AdminConfig showall "Default
Datasource(cells/mycell/nodes/DefaultNode/servers/server1:
  resources.xml#DataSource_1)

Example output:

{authMechanismPreference BASIC_PASSWORD}
{category default}
{connectionPool {{agedTimeout 0}
{connectionTimeout 1000}
{maxConnections 30}
{minConnections 1}
{purgePolicy FailingConnectionOnly}
{reapTime 180}
{unusedTimeout 1800}}}
{datasourceHelperClassname com.ibm.websphere.rsadapter.CloudscapeDataStoreHelper}
{description "Datasource for the WebSphere Default Application"}
{jndiName DefaultDatasource}
{name "Default Datasource"}
{propertySet {{resourceProperties {{{description "Location of Cloudscape 
  default database."}
{name databaseName}
{type java.lang.String}
{value ${WAS_INSTALL_ROOT}/bin/DefaultDB}} {{name remoteDataSourceProtocol}
{type java.lang.String}
{value {}}} {{name shutdownDatabase}
{type java.lang.String}
{value {}}} {{name dataSourceName}
{type java.lang.String}
{value {}}} {{name description}
{type java.lang.String}
{value {}}} {{name connectionAttributes}
{type java.lang.String}
{value {}}} {{name createDatabase}
{type java.lang.String}
{value {}}}}}}}
{provider "Cloudscape 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}

showAttribute
Displays only the value for the single attribute that you specify.

The output of this command is different from the output of the show command when a single attribute is specified. The showAttribute command does not display a list that contains the attribute name and value. It only displays the attribute value.

Parameters: config id, attribute

Example usage:

set ns [$AdminConfig getid /Node:mynode/]
$AdminConfig showAttribute $n hostName

Example output:

mynode

types
Returns a list of the configuration object types that you can manipulate.

Parameters: none

Example usage:

$AdminConfig types

Example output:

AdminService
Agent
ApplicationConfig
ApplicationDeployment
ApplicationServer
AuthMechanism
AuthenticationTarget
AuthorizationConfig
AuthorizationProvider
AuthorizationTableImpl
BackupCluster
CMPConnectionFactory
CORBAObjectNameSpaceBinding
Cell
CellManager
Classloader
ClusterMember
ClusteredTarget
CommonSecureInteropComponent

validate
Invokes validation.

This command requests configuration validation results based on the files in your workspace, the value of the cross-document validation enabled flag, and the validation level setting. The scope of this request is the object named by the config id argument.

Parameters: config id

Example usage:

$AdminConfig validate

Example output:

WASX7193I: Validation results are logged in 
  /QIBM/UserData/WebAS5/Base/myInstance/logs/wsadmin.valout: 
Total number of messages: 16
WASX7194I: Number of messages of severity 1: 16