Websphere application configuration Steps

Below JACL script can be used to modify the configurations of IBM WAS application Server.
#---------------------------------------------------------------------
#--Modify the Configuration of an Application
#-- Configuring starting weight for an application 
#---------------------------------------------------------------------
set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
$AdminConfig modify $aAppDeploy {{startingWeight 10}}
$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring classloader policy for an application 
#---------------------------------------------------------------------
set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
$AdminConfig modify $aAppDeploy {{warClassLoaderPolicy SINGLE}}
$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring classloader loading mode for an application 
#---------------------------------------------------------------------
set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
set aClassloader [$AdminConfig showAttribute $aAppDeploy  classloader]
$AdminConfig modify $aClassloader {{mode PARENT_LAST}}
$AdminConfig save
#---------------------------------------------------------------------
#--Configuring session management for an application 
#---------------------------------------------------------------------
set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
set cookieAttr [list enableCookies false]
set protocolAttr [list enableProtocolSwitchRewriting false]
set urlAttr [list enableUrlRewriting false]
set sslAttr [list enableSSLTracking true]
set accessAttr [list allowSerializedSessionAccess true]
set timeoutAttr [list accessSessionOnTimeout true]
set waitTimeAttr [list maxWaitTime 90]
set modeAttr [list sessionPersistenceMode NONE]
set overflowAttr [list allowOverflow true]
set sessionCountAttr [list maxInMemorySessionCount 1500]
set invalidateTimeoutAttr [list invalidationTimeout 40]
set tuningParamsAttr [list tuningParams [list $overflowAttr $invalidateTimeoutAttr $sessionCountAttr]]
set enableAttr [list enable true]
set attrs [list $cookieAttr $urlAttr $sslAttr $protocolAttr $accessAttr $timeoutAttr $waitTimeAttr $modeAttr $enableAttr $tuningParamsAttr]
set sessionMgrAttr [list [list sessionManagement $attrs]]
$AdminConfig create ApplicationConfig $aAppDeploy $sessionMgrAttr
$AdminConfig save
#---------------------------------------------------------------------
#-- Configuring application loading 
#---------------------------------------------------------------------
set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
set targetMappings [lindex [$AdminConfig showAttribute $aAppDeploy targetMappings] 0]
foreach aTargetMapping $targetMappings {
$AdminConfig modify $aTargetMapping {{enable false}}
}
$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring library reference for an application 
#---------------------------------------------------------------------

set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
set aClassloader [$AdminConfig showAttribute $aAppDeploy classloader]
$AdminConfig create LibraryRef $aClassloader {{libraryName MyshareLibrary} {sharedClassloader true}}
$AdminConfig save

#---------------------------------------------------------------------
#-- Mapping modules to application servers 
#---------------------------------------------------------------------

set aServer WebSphere:cell=myCell,node=myNode,server=myServer
set aServer2 WebSphere:cell=myCell,node=myNode,server=myServer2
set mapping1 [list "Increment Enterprise Java Bean" Increment.jar,META-INF/ejb-jar.xml $aServer]
set mapping2 [list "Default Web Application" DefaultWebApplication.war,WEB-INF/web.xml $aServer2]
set mapServerOpt [list -MapModulesToServers [list $mapping1 $mapping2]]
unset opts
append opts " " $mapServerOpt
lappend opts -appname myApp
$AdminApp edit /installableApps/myApp.ear $opts
$AdminConfig save
#---------------------------------------------------------------------
#--Configuring EJB modules of an application 
#---------------------------------------------------------------------
set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
set modules [lindex [$AdminConfig showAttribute $aAppDeploy modules] 0]
foreach aModule $modules {
if {[regexp EJBModuleDeployment $aModule] == 1} {
$AdminConfig modify $aModule {{startingWeight 1500}}
set targetMappings [lindex [$AdminConfig showAttribute $aModule targetMappings] 0]
foreach aTargetMapping $targetMappings {
$AdminConfig modify $aTargetMapping {{enable false}}
}
}
}
$AdminConfig save
#---------------------------------------------------------------------
#-- Configuring Web modules of an application 
#---------------------------------------------------------------------
set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
set modules [lindex [$AdminConfig showAttribute $aAppDeploy modules] 0]
set weightAttr [list startingWeight 250]
set loaderModeAttr [list classloaderMode PARENT_FIRST]
set nameAttr [list name myWebModuleConfig]
set descAttr [list description "Web Module config post create"]
set enableAttr [list enable true]
set sessionAttr [list $enableAttr]
set sessionMgrAttr [list sessionManagement $sessionAttr]
set webAttrs [list $nameAttr $descAttr $sessionMgrAttr]
foreach aModule $modules {
if {[regexp WebModuleDeployment $aModule] == 1} {
if {[llength [$AdminConfig showAttribute $aModule config]] == 0} {
$AdminConfig create WebModuleConfig $aModule $webAttrs
$AdminConfig modify $aModule [list $weighAttr $loaderModeAttr]
}
}
}
$AdminConfig save
#---------------------------------------------------------------------
#-- Configuring connector modules of an application 
#---------------------------------------------------------------------
set aDeployment [$AdminConfig getid /Deployment:myApp/]
set aAppDeploy [$AdminConfig showAttribute $aDeployment deployedObject]
set modules [lindex [$AdminConfig showAttribute $aAppDeploy modules] 0]
set nameAttr [list name myJ2CCF]
set descAttr [list description "Connection Factory created in application post configuration"]
set authDataAttr [list authDataAlias myNode/DefaultSSLSettings]
set timeoutAttr [list connectionTimeout 150]
set connectionPoolAttr [list connectionPool [list $timeoutAttr]]
set attrs [list $nameAttr $descAttr $authDataAttr $connectionPoolAttr]

foreach aModule $modules {
if {[regexp ConnectorModuleDeployment $aModule] == 1} {
set aResAdapter [$AdminConfig showAttribute $aModule resourceAdapter]
$AdminConfig create J2CConnectionFactory $aResAdapter $attrs
}
}
$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring JDBC provider 
#---------------------------------------------------------------------
set aJDBC [$AdminConfig getid /Node:myNode/JDBCProvider:myJDBCProvider/]
if {[llength $aJDBC] == 0} {
# create a new JDBCProvider with required and optional attributes
set nameAttr [list name myJDBCProvider]
set implAttr [list implementationClassName com.ibm.db2j.jdbc.DB2jConnectionPoolDataSource]
# use CLOUDSCAPE_JDBC_DRIVER_PATH WebSphere variable in setting up classpath
set classpathAttr [list classpath "\${CLOUDSCAPE_JDBC_DRIVER_PATH}/db2j.jar"]
set attrs [list $nameAttr $implAttr $classpathAttr]
set aParent [$AdminConfig getid /Node:myNode/]
set aJDBC [$AdminConfig create JDBCProvider $aParent $attrs]
} else {
# modify existing description
$AdminConfig modify $aJDBC {{description "JDBC Provider with Cloudscape as the implementation class"}}
}

set aDataSource [$AdminConfig getid /Node:myNode/JDBCProvider:myJDBCProvider/DataSource:myDataSource/]
if {[llength $aDataSource] == 0} {
# create a new DataSource with required and optional attributes
set nameAttr [list name myDataSource]
# setup for container-managed authentication using existing alias names defined in security settings
set mappingModuleAttr [list mapping [list [list authDataAlias myNode/DefaultSSLSettings] [list mappingConfigAlias DefaultPrincipalMapping]]]
set attrs [list $nameAttr $mappingModuleAttr]
set aDataSource [$AdminConfig create DataSource $aJDBC $attrs]
}

set aPropertySet [$AdminConfig showAttribute $aDataSource propertySet]
if {[llength $aPropertySet] == 0} {
# create a property set
set aPropertySet [$AdminConfig create J2EEResourcePropertySet $aDataSource {}]
}
# create a custom property
set nameAttr [list name newProperty1]
set valueAttr [list value property1Value]
set requireAttr [list required false]
set typeAttr [list type java.lang.String]
set attrs [list $nameAttr $valueAttr $requireAttr $typeAttr]
$AdminConfig create J2EEResourceProperty $aPropertySet $attrs
# repeat lines 32–37 to set additional custom property
$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring generic JMS provider 
#---------------------------------------------------------------------
set aJMSProvider [$AdminConfig getid /Node:myNode/JMSProvider:myJMSProvider/]
if {[[llength $aJMSProvider] == 0] {
# create a JMSProvider
set nameAttr [list name myJMSProvider]
set contextAttr [list externalInitialContextFactory com.myCompany.jms.myJMSFactory]
set urlAttr [list externalProviderURL http://myJMS]
set attrs [list $nameAttr $contextAttr $urlAttr]
set aNode [$AdminConfig getid /Node:myNode/]
set aJMSProvider [$AdminConfig create JMSProvider $aNode $attrs]
}

set aJMSDestination [$AdminConfig getid /Node:myNode/JMSProvider:myJMSProvider/GenericJMSDestination:myJMSDestination/]
if {[llength $aJMSDestination] == 0} {
# create a JMS queue destination
set nameAttr [list name myJMSDestination]
set jndiAttr [list jndiName jms/JMSDestination]
set extJndiAttr [list externalJNDIName jms/externalJMSD]
# to configure a topic destination, add
# set typeAttr [list type TOPIC] and include
# this attribute to attrs.
set attrs [list $nameAttr $jndiAttr $extJndiAttr]
$AdminConfig create GenericJMSDestination $aJMSProvider $attrs
}

set aJMSCF [$AdminConfig getid /Node:myNode/JMSProvider:myJMSProvider/GenericJMSConnectionFactory:myJMSCF/]
if {[llength $aJMSCF] == 0} {
# create a JMS connection factory
set nameAttr [list name myJMSCF]
set jndiAttr [list jndiName jms/JMSCF]
set extJndiAttr [list externalJNDIName jms/externalJMSCF]
# to configure for a topic destination, add
# set typeAttr [list type TOPIC] and include
# this attribute to attrs.
set attrs [list $nameAttr $jndiAttr $extJndiAttr]
$AdminConfig create GenericJMSConnectionFactory $aJMSProvider $attrs]
}

$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring WebSphere JMS provider 
#---------------------------------------------------------------------

set aWASJMSProvider [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere JMS Provider/"]
set aWASQueueCF [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere JMS Provider/WASQueueConnectionFactory:myWASQueueCF/"]
if {[llength $aWASQueueCF] == 0} {
# create a WAS queue connection factory
set nameAttr [list name myWASQueueCF]
set jndiAttr [list jndiName jms/WASQCF]
# use component-managed authentication
set aliasAttr [list authDataAlias myNode/DefaultSSLSettings]
set nodeAttr [list node myNode]
set attrs [list $nameAttr $jndiAttr $aliasAttr $nodeAttr]
set aWASQueueCF [$AdminConfig create WASQueueConnectionFactory $aWASJMSProvider $attrs]
}
$AdminConfig modify $aWASQueueCF {{description "WAS Queue Connection Factory example"}}

set aWASTopicCF [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere JMS Provider/WASTopicConnectionFactory:myWASTopicCF/"]
if {[llength $aWASTopicCF] == 0} {
# create a WAS topic connection factory
set nameAttr [list name myWASTopicCF]
set jndiAttr [list jndiName jms/WASTCF]
# use container-managed authentication
set mappingModuleAttr [list mapping [list [list authDataAlias myNode/DefaultSSLSettings] [list mappingConfigAlias DefaultPrincipalMapping]]]
set nodeAttr [list node myNode]
set attrs [list $nameAttr $jndiAttr $mappingModuleAttr $nodeAttr]
set aWASTopicCF [$AdminConfig create WASTopicConnectionFactory $aWASJMSProvider $attrs]
}
$AdminConfig modify $aWASTopicCF {{description "WAS Topic Connection Factory example"}}

set aWASQueueDest [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere JMS Provider/WASQueue:myWASQueue/"]
if {[llength $aWASQueueDest] == 0} {
# create a WAS queue destination
set nameAttr [list name myWASQueue]
set jndiAttr [list jndiName jms/WASQD]
set nodeAttr [list node myNode]
set attrs [list $nameAttr $jndiAttr $nodeAttr]
set aWASQueueDest [$AdminConfig create WASQueue $aWASJMSProvider $attrs]
}
set aPropertySet [$AdminConfig showAttribute $aWASQueueDest propertySet]
if {[llength $aPropertySet] == 0} {
# create a property set
set aPropertySet [$AdminConfig create J2EEResourcePropertySet $aWASQueueDest {}]
}
# create a custom property
set nameAttr [list name newProperty1]
set valueAttr [list value property1Value]
set requireAttr [list required false]
set typeAttr [list type java.lang.String]
set attrs [list $nameAttr $valueAttr $requireAttr $typeAttr]
$AdminConfig create J2EEResourceProperty $aPropertySet $attrs

set aWASTopicDest [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere JMS Provider/WASTopic:myWASTopic/"]
if {[llength $aWASTopicDest] == 0} {
# create a WAS topic destination
set nameAttr [list name myWASTopic]
set jndiAttr [list jndiName jms/WASTD]
set nodeAttr [list node myNode]
set topicAttr [list topic myWASTopic]
set attrs [list $nameAttr $jndiAttr $nodeAttr $topicAttr]
set aWASTopicDest [$AdminConfig create WASTopic $aWASJMSProvider $attrs]
}

# modify persistence attribute to indicate messages sent to destination is not persistent
$AdminConfig modify $aWASTopicDest {{persistence NONPERSISTENT}}

$AdminConfig save
#---------------------------------------------------------------------
#-- Configuring WebSphere MQ JMS provider 
#---------------------------------------------------------------------
set aMQJMSProvider [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere MQ JMS Provider/"]
set aMQQueueCF [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere MQ JMS Provider/MQQueueConnectionFactory:myMQQueueCF/"]
if {[llength $aMQQueueCF] == 0} {
# create a MQ queue connection factory
set nameAttr [list name myMQQueueCF]
set jndiAttr [list jndiName jms/MQQCF]
# use component-managed authentication
set aliasAttr [list authDataAlias myNode/DefaultSSLSettings]
set attrs [list $nameAttr $jndiAttr $aliasAttr]
set aMQQueueCF [$AdminConfig create MQQueueConnectionFactory $aMQJMSProvider $attrs]
}

$AdminConfig modify $aMQQueueCF {{description "MQ Queue Connection Factory example"}}

set aMQTopicCF [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere MQ JMS Provider/MQTopicConnectionFactory:myMQTopicCF/"]
if {[llength $aMQTopicCF] == 0} {
# create a MQ topic connection factory
set nameAttr [list name myMQTopicCF]
set jndiAttr [list jndiName jms/MQTCF]
# use container-managed authentication
set mappingModuleAttr [list mapping [list [list authDataAlias myNode/DefaultSSLSettings] [list mappingConfigAlias DefaultPrincipalMapping]]
set attrs [list $nameAttr $jndiAttr $mappingModuleAttr]
set aMQTopicCF [$AdminConfig create MQTopicConnectionFactory $aMQJMSProvider $attrs]
}
$AdminConfig modify $aMQTopicCF {{description "MQ Topic Connection Factory example"}}

set aMQQueueDest [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere MQ JMS Provider/MQQueue:myMQQueue/"]
if {[llength $aMQQueueDest] == 0} {
# create a MQ queue destination
set nameAttr [list name myMQQueue]
set jndiAttr [list jndiName jms/MQQD]
set queueAttr [list baseQueueName myMQQueue]
set queueManagerAttr [list baseQueueManagerName myMQQueueManager]
set attrs [list $nameAttr $jndiAttr $queueAttr $queueManagerAttr]
set aMQQueueDest [$AdminConfig create MQQueue $aMQJMSProvider $attrs]
}
set aPropertySet [$AdminConfig showAttribute $aMQQueueDest propertySet]
if {[llength $aPropertySet] == 0} {
# create a property set
set aPropertySet [$AdminConfig create J2EEResourcePropertySet $aMQQueueDest {}]
}
# create a custom property
set nameAttr [list name newProperty1]
set valueAttr [list value property1Value]
set requireAttr [list required false]
set typeAttr [list type java.lang.String]
set attrs [list $nameAttr $valueAttr $requireAttr $typeAttr]
$AdminConfig create J2EEResourceProperty $aPropertySet $attrs

set aMQTopicDest [$AdminConfig getid "/Node:myNode/JMSProvider:WebSphere MQ JMS Provider/MQTopic:myMQTopic/"]
if {[llength $aMQTopicDest] == 0} {
# create a MQ topic destination
set nameAttr [list name myMQTopic]
set jndiAttr [list jndiName jms/MQTD]
set topicAttr [list baseTopicName myMQTopic]
set attrs [list $nameAttr $jndiAttr $topicAttr]
set aMQTopicDest [$AdminConfig create MQTopic $aMQJMSProvider $attrs]
}

# modify persistence attribute to indicate messages sent to destination is not persistent
$AdminConfig modify $aMQTopicDest {{persistence NONPERSISTENT}}

$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring mail provider 
#---------------------------------------------------------------------
set aMailProvider [$AdminConfig getid /Node:myNode/MailProvider:myMailProvider/]
if {[llength $aMailProvider] == 0} {
# create a mail provider
set nameAttr [list name myMailProvider]
set descAttr [list description "Mail Provider example"]
set attrs [list $nameAttr $descAttr]
set aNodeParent [$AdminConfig getid /Node:myNode/]
set aMailProvider [$AdminConfig create MailProvider $aNodeParent $attrs]
}

set aPropertySet [$AdminConfig showAttribute $aMailProvider propertySet]
if {[llength $aPropertySet] == 0} {
# create a property set
set aPropertySet [$AdminConfig create J2EEResourcePropertySet $aMailProvider {}]
}
# create a custom property in the property set
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set requireAttr [list required false]
set typeAttr [list type java.lang.String]
set attrs [list $nameAttr $valueAttr $requireAttr $typeAttr]
$AdminConfig create J2EEResourceProperty $aPropertySet $attrs

set aProtocolProvider [$AdminConfig getid /Node:myNode/MailProvider:myMailProvider/ProtocolProvider:myProtocolProvider/]
if {[llength $aProtocolProvider] == 0} {
# create a protocol provider
set protocolAttr [list protocol myProtocolProvider]
set classnameAttr [list classname com.my.mail.myProtocolProvider.MYPROTOCOLPROVIDERSTORE]
set typeAttr [list type STORE]
set attrs [list $protocolAttr $classnameAttr $typeAttr]
set aProtocolProvider [$AdminConfig create ProtocolProvider $aMailProvider $attrs]
}

set aMailSession [$AdminConfig getid /Node:myNode/MailProvider:myMailProvider/MailSession:myMailSession/]
if {[llength $aMailSession] == 0} {
# create a mail session
set nameAttr [list name myMailSession]
set jndiAttr [list jndiName mail/myMailSession]
set storeProtocolAttr [list mailStoreProtocol $aProtocolProvider]
set storeHostAttr [list mailStoreHost myMailServer]
set storeUserAttr [list mailStoreUser myMailUser]
set storePasswordAttr [list mailStorePassword myMailPassword]
set attrs [list $nameAttr $jndiAttr $storeProtocolAttr $storeHostAttr $storeUserAttr $storePasswordAttr]
set aMailSession [$AdminConfig create MailSession $aMailProvider $attrs]
}

$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring resource environment provider 
#---------------------------------------------------------------------
set aResEnvProvider [$AdminConfig getid /Node:myNode/Server:myServer/ResourceEnvironmentProvider:myResEnvProvider/]
if {[llength $aResEnvProvider] == 0} {
# create a resource environment provider
set nameAttr [list name myResEnvProvider]
set descAttr [list description "Resource Environment Provider example"]
set attrs [list $nameAttr $descAttr]
set aServerParent [$AdminConfig getid /Node:myNode/Server:myServer/]
set aResEnvProvider [$AdminConfig create ResourceEnvironmentProvider $aServerParent $attrs]
}
$AdminConfig modify $aResEnvProvider {{classpath /Resource/myResource.jar}}
set aPropertySet [$AdminConfig showAttribute $aResEnvProvider propertySet]
if {[llength $aPropertySet] == 0} {
# create a property set
set aPropertySet [$AdminConfig create J2EEResourcePropertySet $aResEnvProvider {}]
}
# create a custom property in the property set
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set requireAttr [list required false]
set typeAttr [list type java.lang.String]
set attrs [list $nameAttr $valueAttr $requireAttr $typeAttr]
$AdminConfig create J2EEResourceProperty $aPropertySet $attrs

set aRef [$AdminConfig getid /Node:myNode/Server:myServer/ResourceEnvironmentProvider:myResEnvProvider/Referenceable:myRef/]
if {[llength $aRef] == 0} {
# create a referenceable
set factoryClassnameAttr [list factoryClassname com.my.resourceEnv.objectFactory]
set classnameAttr [list classname java.util.Properties]
set attrs [list $factoryClassnameAttr $classnameAttr]
set aRef [$AdminConfig create Referenceable $aResEnvProvider $attrs]
}

set aResEnvEntry [$AdminConfig getid /Node:myNode/Server:myServer/ResourceEnvironmentProvider:myResEnvProvider/ResourceEnvEntry:myResEnvEntry/]
if {[llength $aResEnvEntry] == 0} {
# create a resource environment entry
set nameAttr [list name myResEnvEntry]
set jndiAttr [list jndiName mail/myResEnv]
set refAttr [list referenceable $aRef]
set attrs [list $nameAttr $jndiAtr $refAttr]
set aResEnvEntry [$AdminConfig create ResourceEnvEntry $aResEnvProvider $attrs]
}

$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring URL provider 
#---------------------------------------------------------------------
set aURLrovider [$AdminConfig getid /Node:myNode/URLProvider:myURLProvider/]
if {[llength $aURLProvider] == 0} {
# create a URL provider
set nameAttr [list name myURLProvider]
set protocolAttr [list protocol ftp]
set streamHandlerAttr [list streamHandlerClassName com.my.URL.streamHandler]
set attrs [list $nameAttr $protocolAttr $streamHandlerAttr]
set aNodeParent [$AdminConfig getid /Node:myNode/]
set aURLProvider [$AdminConfig create URLProvider $aNodeParent $attrs]
}

$AdminConfig modify $aURLProvider {{description "URL Provider example"}}

set aPropertySet [$AdminConfig showAttribute $aURLProvider propertySet]
if {[llength $aPropertySet] == 0} {
# create a property set
set aPropertySet [$AdminConfig create J2EEResourcePropertySet $aURLProvider {}]
}
# create a custom property in the property set
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set requireAttr [list required false]
set typeAttr [list type java.lang.String]
set attrs [list $nameAttr $valueAttr $requireAttr $typeAttr]
$AdminConfig create J2EEResourceProperty $aPropertySet $attrs

set aURL [$AdminConfig getid /Node:myNode/URLProvider:myURLProvider/URL:myURL/]
if {[llength $aURL] == 0} {
# create a URL
set nameAttr [list name myURL]
set jndiAttr [list jndiName URL/myURL]
set specAttr [list spec mySpec]
set attrs [list $nameAttr $jndiAttr $specAttr]
set aURL [$AdminConfig create URL $aURLProvider $attrs]
}

$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring resource adapter 
#---------------------------------------------------------------------
set aJ2CRA [$AdminConfig getid /Node:myNode/J2CResourceAdapter:myJ2CRA/]
if {[llength $aJ2CRA] == 0} {
# create a J2C resource adapter
set options [list -rar.name myJ2CRA -rar.description "This is a J2C resource adapter example"]
set rarFile /installable/myra.rar
set aJ2CRA [$AdminConfig installResourceAdapter $rarFile $options]
}

set aPropertySet [$AdminConfig showAttribute $aJ2CRA propertySet]
if {[llength $aPropertySet] != 0} {
puts [$AdminConfig showall $aPropertySet]
} else {
puts "There is no custom properties for this resource adapter."
}

set aJ2CCF [$AdminConfig getid /Node:myNode/J2CResourceAdapter:myJ2CRA/J2CConnectionFactory:myJ2CCF/]
if {[llength $aJ2CCF] == 0} {
# create a J2C connection factory
set nameAttr [list name myJ2CCF]
set jndiAttr [list jndiName eis/myj2ccf]
set authAliasAttr [list authDataAlias myNode/defaultSSLSettings]
set attrs [list $nameAttr $jndiAttr $authAliasAttr]
set aJ2CCF [$AdminConfig create J2CConnectionFactory $aJ2CRA $attrs]
}

# configure connection pool
set maxConnAttr [list maxConnections 13]
set aConnPool [$AdminConfig showAttribute $aJ2CCF connectionPool]
if {[llength $aConnPool] == 0} {
# create a connection pool using defaults except for maximum connections
set aConnPool [$AdminConfig create ConnectionPool $aJ2CCF {}]
}
$AdminConfig modify $aConnPool [list $maxConnAttr]

$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring global security 
#---------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
# modify existing security configuration properties
set enableAttr [list enable true]
set java2SecurityAttr [list enforceJava2Security true]
set domainAttr [list useDomainQualifiedUserNames true]
set cacheTimeoutAttr [list cacheTimeout 100]
set protocolAttr [list activeProtocol CSI]
set attrs [list $enableAttr $java2SecurityAttr $domainAttr $cacheTimeoutAttr $protocolAttr]
$AdminConfig modify $aSec $attrs

# enable FIPS
set properties [lindex [$AdminConfig showAttribute $aSec properties] 0]
set foundFIPS false
if {[llength $properties] != 0} {
foreach aProperty $properties {
if {[$AdminConfig showAttribute $aProperty name] == "com.ibm.security.userFIPS"} {
$AdminConfig modify $aProperty {{value true}}
set foundFIPS true
}
}
}
if {$foundFIPS == "false"} {
set nameAttr [list name com.ibm.security.useFIPS]
set valueAttr [list value true]
set attrs [list $nameAttr $valueAttr]
$AdminConfig create Property $aSec $attrs
}

$AdminConfig save

#---------------------------------------------------------------------
#-- Configuring SSL 
#---------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set repertoires [lindex [$AdminConfig showAttribute $aSec repertoire] 0]
set foundSSL = false
if {[llength $repertoires] != 0} {
foreach aRepertoire $repertoires {
if {[$AdminConfig showAttribute $aRepertoire alias] == "myCell/mySSLSettings"} {
set foundSSL $aRepertoire
}
}
}

if {$foundSSL == "false"} {
# create a repertoire named myCell/mySSLSettings
set aliasAttr [list alias myCell/mySSLSettings]
set keyFileAttr [list keyFileName \${USER_INSTALL_ROOT}/etc/DummyServerKeyFile.jks]
set keyPasswordAttr [list keyFilePassword mypassword]
set keyFormatAttr [list keyFileFormat JCEK]
set trustFileAttr [list trustFileName \${USER_INSTALL_ROOT}/etc/DummyServerTrustFile.jks]
set trustPasswordAttr [list trustFilePassword mypassword]
set trustFormatAttr [list trustFileFormat JCEK]
set secLevelAttr [list securityLevel MEDIUM]
set settingAttrs [list setting [list $keyFileAttr $keyPasswordAttr $keyFormatAttr $trustFileAttr $trustPasswordAttr $trustFormatAttr $secLevelAttr]]
set attrs [list $aliasAttr $settingAttr]
set foundSSL [$AdminConfig create SSLConfig $aSec $attrs repertoire]
}
set ssl [$AdminConfig showAttribute $foundSSL setting]
# configure for cryptographic token
set enableAttr [list enableCryptoHardwareSupport true]
$AdminConfig modify $ssl [list $enableAttr]
set crypto [$AdminConfig showAttribute $ssl cryptoHardware]
if {[llength $crypto] == 0} {
set passwordAttr [list password mypassword]
set attrs [list $passwordAttr]
$AdminConfig create CryptoHardwareToken $ssl $attrs
}

# configure for custom property
set properties [lindex [$AdminConfig showAttribute $ssl properties] 0]
if {[llength $properties] == 0} {
# configure provider property
set nameAttr [list name com.ibm.ssl.contextProvider]
set valueAttr [list value IBMJSSE]
set attrs [list $nameAttr $valueAttr]
$AdminConfig create Property $ssl $attrs
# configure protocol property
set nameAttr [list name com.ibm.ssl.protocol]
set valueAttr [list value SSLv3]
set attrs [list $nameAttr $valueAttr]
$AdminConfig create Property $ssl attrs
# configure cipher suites
set nameAttr [list name com.ibm.ssl.enabledCipherSuites]
set valueAttr [list value SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
set attrs [list $nameAttr $valueAttr]
$AdminConfig create Property $ssl $attrs
}

$AdminConfig save
#---------------------------------------------------------------------
#-- Configuring LTPA 
#---------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set aLTPA [$AdminConfig list LTPA $aSec]
if {[llength $aLTPA] != 0} {
# modify LTPA to use LTPA keys

# assuming network deployment environment, for application server environment, change process value accordingly.
set aRunningSecMBean [$AdminControl queryNames type=SecurityAdmin,process=dmgr,*]
set sharedKey null
set privateKey null
set publicKey null
if {[llength $aRunningSecMBean] != 0} {
puts "Generate LTPA keys"
$AdminControl invoke $aRunningSecMBean generateKeys mypassword
puts "Export LTPA keys"
set result [$AdminControl invoke $aRunningSecMBean exportLTPAKeys]
# look for public, private, and shared keys
for {set x 0} {$x < 7} {incr x} {
set key [lindex [lindex $result $x] 0]
set value [lindex [lindex $result $x] 1]
if {[string compare $key com.ibm.websphere.ltpa.3DESKey] == 0} {
set sharedKey $value
} elseif {[string compare $key com.ibm.websphere.ltpa.PrivateKey] == 0} {
set privateKey $value
} elseif {[string compare $key com.ibm.websphere.ltpa.PublicKey] == 0} {
set publicKey $value
}
}
}

set passwordAttr [list password mypassword]
set sharedAttr [list shared [list [list byteArray $sharedKey]]]
set privateAttr [list private [list [list byteArray $privateKey]]]
set publicAttr [list public [list [list byteArray $publicKey]]]
# set timeout in minutes
set timeoutAttr [list timeout 100]
set attrs [list $passwordAttr $sharedAttr $privateAttr $publicAttr $timeoutAttr]
$AdminConfig modify $aLTPA $attrs

# configure single signon
set enableAttr [list enable true]
set sslAttr [list requiresSSL false]
set domainAttr [list domainName my.com]
set signon [$AdminConfig showAttribute $aLTPA singleSignon]
set attrs [list $enableAttr $sslAttr $domainAttr]
$AdminConfig modify $signon $attrs

$AdminConfig save
#---------------------------------------------------------------------
#-- Configuring local OS user registry 
#---------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set userRegistry [$AdminConfig list LocalOSUserRegistry $aSec]
if {[llength $userRegistry] != 0} {
# modify server id and password
set idAttr [list serverId myServerId]
set passwordAttr [list serverPassword myServerPassword]
set attrs [list $idAttr $passwordAttr]
$AdminConfig modify $userRegistry $attrs

# Add a property
set nameAttr [list name property1]
set valueAttr [list value propertyValue1]
set attrs [list $nameAttr $valueAttr]
$AdminConfig create Property $userRegistry $attrs

$AdminConfig save
}

#---------------------------------------------------------------------
#-- Configuring LDAP user registry 
#---------------------------------------------------------------------


set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set userRegistry [$AdminConfig list LDAPUserRegistry $aSec]
if {[llength $userRegistry] != 0} {
# modify server id, password, sslConfig and ignore case properties
set idAttr [list serverId myServerId]
set passwordAttr [list serverPassword myServerPassword]
set sslConfigAttr [list sslConfig myCell/DefaultSSLSettings]
set ignoreAttr [list ignoreCase true]
set attrs [list $idAttr $passwordAttr $sslConfigAttr $ignoreAttr]
$AdminConfig modify $userRegistry $attrs

# modify LDAP server host
set endpoints [lindex [$AdminConfig showAttribute $userRegistry hosts] 0]
if {[llength $endpoints] != 0} {
foreach $aEndpoint $endpoints {
if {[$AdminConfig showAttribute $aEndpoint port] == 389} {
$AdminConfig modify $aEndpoint {{host myHost}}
}
}
}

# modify advanced LDAP settings
set filter [$AdminConfig showAttribute $userRegistry searchFilter]
if {[llength $filter] != 0} {
$AdminConfig modify $filter {{certificateMapMode EXACT_DN}}
}

# Add a property
set nameAttr [list name property1]
set valueAttr [list value propertyValue1]
set attrs [list $nameAttr $valueAttr]
$AdminConfig create Property $userRegistry $attrs

$AdminConfig save
}

#-------------------------------------------------------------------------
#--Configuring custom user registry 
#-------------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set userRegistry [$AdminConfig list CustomUserRegistry $aSec]
if {[llength $userRegistry] != 0} {
# configure server id, password, and registry classname
set idAttr [list serverId myServerId]
set passwordAttr [list serverPassword myServerPassword]
set classnameAttr [list customRegistryClassName com.ibm.websphere.security.FileRegistrySample]
set attrs [list $idAttr $passwordAttr $classnameAttr]
$AdminConfig modify $userRegistry $attrs

# Add a property
set nameAttr [list name property1]
set valueAttr [list value propertyValue1]
set attrs [list $nameAttr $valueAttr]
$AdminConfig create Property $userRegistry $attrs

$AdminConfig save
}


#-------------------------------------------------------------------------
#-- Configuring application login 
#-------------------------------------------------------------------------

set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set appLogin [$AdminConfig showAttribute $aSec applicationLoginConfig]
if {[llength $appLogin] != 0} {
set entries [lindex [$AdminConfig showAttribute $appLogin entries] 0]
puts "Login configurations: "
puts $entries

# look for JAAS login module named myAppLogin
set found false
foreach aEntry $entries {
if {[$AdminConfig showAttribute $aEntry alias] == "myAppLogin"} {
puts "Found login configuration named myAppLogin"
set found $aEntry
break
}
}

if {$found == "false"} {
# create an application login
puts "Create a login configuration named myAppLogin"
set aliasAttr [list alias myAppLogin]
set strategyAttr [list authenticationStrategy REQUIRED]
set moduleClassAttr [list moduleClassName com.my.server.common.auth.module.proxy.myProxyImpl]
set loginModuleAttr [list loginModules [list [list $strategyAttr $moduleClassAttr]]]
set attrs [list $aliasAttr $loginModuleAttr]
set found [$AdminConfig create JAASConfigurationEntry $appLogin $attrs]
} else {
# modify existing login configuration
puts "Modify classname for existing login configuration myAppLogin"
set loginModules [lindex [$AdminConfig showAttribute $found loginModules] 0]
foreach aLoginModule $loginModules {
if {[$AdminConfig showAttribute $aLoginModule moduleClassName] == "com.my.server.com.auth.module.proxy.proxyImpl"} {
$AdminConfig modify $aLoginModule {{moduleClassName "com.my.server.com.auth.module.proxy.myProxyImpl"}}
}
}
}

# look for login configuration named myOldAppLogin
set found false
foreach aEntry $entries {
if {[$AdminConfig showAttribute $aEntry alias] == "myOldAppLogin"} {
puts "Found login configuration named myOldAppLogin"
set found $aEntry
break
}
}
if {$found != "false"} {
# remove existing login configuration entry
puts "Remove existing login configuration named myOldAppLogin"
$AdminConfig remove $found
}
$AdminConfig save
}


#-------------------------------------------------------------------------
#-- Configuring J2C authentication data 
#-------------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set authDataEntries [lindex [$AdminConfig showAttribute $aSec authDataEntries] 0]
if {[llength $authDataEntries] == 0} {
# create a auth data named myAuthData
puts "Create a auth data named myCell/myAuthData"
set aliasAttr [list alias myCell/myAuthData]
set userAttr [list userId myUser]
set passwordAttr [list password myPassword]
set attrs [list $aliasAttr $uesrAttr $passwordAttr]
$AdminConfig create JAASAuthData $aSec $attrs
} else {
puts "JAAS authentication data: "
puts $authDataEntries

foreach aAuthEntry $authDataEntries {
if {[$AdminConfig showAttribute $aAuthEntry alias] == "myCell/myAuthData"} {
puts "Modify password property for JAAS authentication data named myCell/myAuthData"
$AdminConfig modify $aAuthEntry {{password myPassword}}
}
}
}

$AdminConfig save

#-------------------------------------------------------------------------
#-- Configuring CSIv2 inbound authentication 
#-------------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set csi [$AdminConfig showAttribute $aSec CSI]
set claim [$AdminConfig showAttribute $csi claims]
if {[regexp CommonSecureInterop $claim] == 1} {
set layers [lindex [$AdminConfig showAttribute $claim layers] 0]
foreach aLayer $layers {
if {[regexp IdentityAssertionLayer $aLayer] == 1} {
# create trusted server
set serverIdAttr [list serverId myServerId]
set attrs [list $serverIdAttr]
$AdminConfig create ServerIdentity $aLayer $attrs

set supportedQOP [$AdminConfig showAttribute $aLayer supportedQOP]
# modify to enable identity assertion
$AdminConfig modify $supportedQOP {{enable true}}
}
if {[regexp Transportlayer $aLayer] == 1} {
set supportedQOP [$AdminConfig showAttribute $aLayer supportedQOP]
set requiredQOP [$AdminConfig showAttribute $aLayer requiredQOP]
# set client certificate authentication to required.
# To set to supported,
# $AdminConfig modify $requiredQOP {{establishTrustInClient false}}
#$AdminConfig modify $supportedQOP  {{establishTrustInClient true}}
# To set to never, set establishTrustInClient attribute to false in both requiredQOP and supportedQOP.
$AdminConfig modify $requiredQOP {{establishTrustInClient true}}
$AdminConfig modify $supportedQOP {{establishTrustInClient false}}
}
if {[regexp MessageLayer $aLayer] == 1} {
set supportedQOP [$AdminConfig showAttribute $aLayer supportedQOP]
set requiredQOP [$AdminConfig showAttribute $aLayer requiredQOP]
# set basic authentication to required.
# To set to supported,
# $AdminConfig modify $requiredQOP {{establishTrustInClient false}}
# $AdminConfig modify $supportedQOP  {{establishTrustInClient true}}
# To set to never, set establishTrustInClient attribute to false in both requiredQOP and supportedQOP.
$AdminConfig modify $requiredQOP {{establishTrustInClient true}}
$AdminConfig modify $supportedQOP {{establishTrustInClient false}}
}
}

# set stateful
$AdminConfig modify $claim {{stateful true}}

$AdminConfig save
}

#-------------------------------------------------------------------------
#-- Configuring CSIv2 outbound authentication 
#-------------------------------------------------------------------------

set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set csi [$AdminConfig showAttribute $aSec CSI]
set perform [$AdminConfig showAttribute $csi performs]
if {[regexp CommonSecureInterop $perform] == 1} {
set layers [lindex [$AdminConfig showAttribute $perform layers] 0]
foreach aLayer $layers {
if {[regexp IdentityAssertionLayer $aLayer] == 1} {
set supportedQOP [$AdminConfig showAttribute $aLayer supportedQOP]
# modify to enable identity assertion
$AdminConfig modify $supportedQOP {{enable true}}
}
if {[regexp Transportlayer $aLayer] == 1} {
set supportedQOP [$AdminConfig showAttribute $aLayer supportedQOP]
set requiredQOP [$AdminConfig showAttribute $aLayer requiredQOP]
# set client certificate authentication to required.
# To set to supported,
# $AdminConfig modify $requiredQOP {{establishTrustInClient false}}
#$AdminConfig modify $supportedQOP {{establishTrustInClient true}}
# To set to never, set establishTrustInClient attribute to false in both requiredQOP and supportedQOP.
$AdminConfig modify $requiredQOP {{establishTrustInClient true}}
$AdminConfig modify $supportedQOP {{establishTrustInClient false}}
}
if {[regexp MessageLayer $aLayer] == 1} {
set supportedQOP [$AdminConfig showAttribute $aLayer supportedQOP]
set requiredQOP [$AdminConfig showAttribute $aLayer requiredQOP]
# set basic authentication to required.
# To set to supported,
# $AdminConfig modify $requiredQOP {{establishTrustInClient false}}
# $AdminConfig modify $supportedQOP {{establishTrustInClient true}}
# To set to never, set establishTrustInClient attribute to false in both requiredQOP and supportedQOP.
$AdminConfig modify $requiredQOP {{establishTrustInClient true}}
$AdminConfig modify $supportedQOP {{establishTrustInClient false}}
}
}

# set stateful
$AdminConfig modify $perform {{stateful true}}

$AdminConfig save
}
#-------------------------------------------------------------------------
#-- Configuring CSIv2 inbound transport 
#-------------------------------------------------------------------------

set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set csi [$AdminConfig showAttribute $aSec CSI]
set claim [$AdminConfig showAttribute $csi claims]
if {[regexp CommonSecureInterop $claim] == 1} {
set layers [lindex [$AdminConfig showAttribute $claim layers] 0]
foreach aLayer $layers {
if {[regexp Transportlayer $aLayer] == 1} {
set supportedQOP [$AdminConfig showAttribute $aLayer supportedQOP]
set requiredQOP [$AdminConfig showAttribute $aLayer requiredQOP]
# configure transport to SSL-required.
# To set to SSL-supported,
# $AdminConfig modify $requiredQOP {{enableProtection false}}
# $AdminConfig modify $supportedQOP {{enableProtection true}}
# To set to TCPIP, set enableProtection attribute to false in both requiredQOP and supportedQOP.
$AdminConfig modify $requiredQOP {{enableProtection true}}
$AdminConfig modify $supportedQOP {{enableProtection false}}

# configure SSL settings
set serverAuth [$AdminConfig showAttribute $aLayer serverAuthentication]
$AdminConfig modify $serverAuth {{sslConfig myNode/mySSLSettings}}

$AdminConfig save
}
}
}

#--------------------------------------------------------------------------
#-- Configuring CSIv2 outbound transport 
#--------------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set csi [$AdminConfig showAttribute $aSec CSI]
set perform [$AdminConfig showAttribute $csi performs]
if {[regexp CommonSecureInterop $perform] == 1} {
set layers [lindex [$AdminConfig showAttribute $perform layers] 0]
foreach aLayer $layers {
if {[regexp Transportlayer $aLayer] == 1} {
set supportedQOP [$AdminConfig showAttribute $aLayer supportedQOP]
set requiredQOP [$AdminConfig showAttribute $aLayer requiredQOP]
# configure transport to SSL-required.
# To set to SSL-supported,
# $AdminConfig modify $requiredQOP {{enableProtection false}}
# $AdminConfig modify $supportedQOP {{enableProtection true}}
# To set to TCPIP, set enableProtection attribute to false in both requiredQOP and supportedQOP.
$AdminConfig modify $requiredQOP {{enableProtection true}}
$AdminConfig modify $supportedQOP {{enableProtection false}}

# configure SSL settings
set serverAuth [$AdminConfig showAttribute $aLayer serverAuthentication]
$AdminConfig modify $serverAuth {{sslConfig myNode/mySSLSettings}}

$AdminConfig save
}
}
}

#--------------------------------------------------------------------------
#-- Configuring SAS inbound transport 
#--------------------------------------------------------------------------

set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set ibm [$AdminConfig showAttribute $aSec IBM]
set claim [$AdminConfig showAttribute $ibm claims]
if {[regexp SecureAssociationService $claim] == 1} {
set layers [lindex [$AdminConfig showAttribute $claim layers] 0]
foreach aLayer $layers {
if {[regexp Transportlayer $aLayer] == 1} {
# configure SSL settings
set serverAuth [$AdminConfig showAttribute $aLayer serverAuthentication]
$AdminConfig modify $serverAuth {{sslConfig myNode/mySSLSettings}}

$AdminConfig save
}
}
}
#--------------------------------------------------------------------------
#-- Configuring SAS outbound transport 
#--------------------------------------------------------------------------
set aSec [$AdminConfig getid /Cell:myCell/Security:/]
set ibm [$AdminConfig showAttribute $aSec IBM]
set perform [$AdminConfig showAttribute $ibm performs]
if {[regexp SecureAssociationService $perform] == 1} {
set layers [lindex [$AdminConfig showAttribute $perform layers] 0]
foreach aLayer $layers {
if {[regexp Transportlayer $aLayer] == 1} {
# configure SSL settings
set serverAuth [$AdminConfig showAttribute $aLayer serverAuthentication]
$AdminConfig modify $serverAuth {{sslConfig myNode/mySSLSettings}}

$AdminConfig save
}
}
}

#--------------------------------------------------------------------------
#-- Updating plug-in configuration 
#--------------------------------------------------------------------------

set pluginGen [$AdminControl completeObjectName type=PluginCfgGenerator,*]
$AdminControl invoke $pluginGen generate "c:/WebSphere/DeploymentManager c:/WebSphere/DeploymentManager/config mycell null null plugin-cfg.xml"
#--------------------------------------------------------------------------
#-- Configuring virtual host 
#--------------------------------------------------------------------------

set aVH [$AdminConfig getid /Node:myNode/VirtualHost:myVH/]
if {[llength $aVH] == 0} {
# create a virtual host
set aNodeParent [$AdminConfig getid /Node:myNode/]
set aVH [$AdminConfig create VirtualHost $aNodeParent {{name myVH}}]
}

set aliases [lindex [$AdminConfig showAttributes $aVH aliases] 0]
if {[llength $aliases] == 0} {
# create the first host alias
set hostAttr [list hostname *]
set portAttr [list port 9010]
set attrs [list $hostAttr $portAttr]
$AdminConfig create HostAlias $aVH $attrs
# create the second host alias
set portAttr [list port 9012]
set attrs [list $hostAttr $portAttr]
# this create command will append the second host alias entry into the existing list
$AdminConfig create HostAlias $aVH $attrs
} else {
foreach aAlias $aliases {
# modify existing alias to change port
if {[$AdminConfig showAttribute $aAlias port] == 9000} {
$AdminConfig modify $aAlias {{port 9010}}
}
}
}

# add a new MIME entry to map new extension mapping
set extAttr [list extensions myt]
set typeAttr [list type application/myType]
set attrs [list $extensions $type]
$AdminConfig create MimeEntry $aVH $attrs
$AdminConfig save
#--------------------------------------------------------------------------
#-- Configuring WebSphere variables 
#--------------------------------------------------------------------------

set aNodeVarMap [$AdminConfig getid /Node:myNode/VariableMap:/]
if {[llength $aNodeVarMap] == 0} {
# create an empty node scope WebSphere variables file
set aNodeParent [$AdminConfig getid /Node:myNode/]
set aNodeVarMap [$AdminConfig create VariableMap $aNodeParent {}]
}

# look for WebSphere variable named MY_HOME
set entries [lindex [$AdminConfig showAttributes $aNodeVarMap entries] 0]
set foundEntry false
if {[llength $entries] != 0} {
foreach aEntry $entries {
if {[$AdminConfig showAttribute $aEntry symbolicName] == "MY_HOME"} {
set foundEntry $aEntry
}
}
}
if {$foundEntry == "false"} {
# create a WebSphere variable named MY_HOME
set nameAttr [list symbolicName MY_HOME]
set valueAttr [list value c:/home]
set descAttr [list description "The path to my home directory"]
set entryAttr [list $nameAttr $valueAttr $descAttr]
$AdminConfig create VariableSubstitutionEntry $aNodeVarMap $entryAttr
} else {
# modify MY_HOME WebSphere variable
set valueAttr [list value c:/home]
set attrs [list $valueAttr]
$AdminConfig modify $foundEntry $attrs
}

$AdminConfig save

#-------------------------------------------------------------------------
#-- Configuring shared library 
#-------------------------------------------------------------------------

set aSharedLib [$AdminConfig getid /Node:myNode/Server:myServer/Library:mySharedLibrary/]
if {[llength $aSharedLib] == 0} {
# create a shared library named mySharedLibrary
set nameAttr [list name mySharedLibrary]
set classpathAttr [list classPath \${MY_HOME}/mylib/mySharedLib.jar]
set attrs [list $nameAttr $classpathAttr]
set aServerParent [$AdminConfig getid /Node:myNode/Server:myServer/]
set aSharedLib [$AdminConfig create Library $aServerParent $attrs]
} else {
# modify existing shared library property
set classpathAttr [list classPath \${MY_HOME}/mylib/mySharedLib.jar]
set attrs [list $classpathAttr]
$AdminConfig modify $aSharedLib $attrs]
}

$AdminConfig save

#-------------------------------------------------------------------------
#-- Configuring internal replication domain 
#-------------------------------------------------------------------------

set aCellParent [$AdminConfig getid /Cell:myCell/]
set replicators [$AdminConfig list MultibrokerDomain $aCellParent]
if {[llength $replicators] != 0} {
puts "Existing list of internal replication domains:"
foreach aReplicator $replicators {
set name [$AdminConfig showAttribute $aReplicator name]
puts "$name"
}
}

set myReplicator [$AdminConfig getid /Cell:myCell/MultibrokerDomain:myReplicator/]
if {[llength $myReplicator] == 0} {
# create a replicator named myReplicator
puts "Create an internal replication domain named myReplicator"
set nameAttr [list name myReplicator]
set encryptTimeoutAttr [list requestTimeout 5]
# valid values for encryption type are DES, TRIPLE_DES, NONE
set encryptTypeAttr [list encryptionType NONE]
set drsSizeAttr [list size 10]
set drsPartitionAttr [list partitionOnEntry false]
set drsAttr [list partition [list $drsSizeAttr $drsPartitionAttr]]
set entrySerializeKindAttr [list entrySerializationKind BYTES]
set propertySerializeKindAttr [list propertySerializationKind BYTES]
set serializationAttr [list serialization [list $entrySerializeKindAttr $propertySerializeKindAttr]]
set poolConnectionAttr [list poolConnections false]
set poolSizeAttr [list size 10]
set poolAttr [list pooling [list $poolConnectionAttr $poolSizeAttr]]
set replicationSettingAttr [list defaultDataReplicationSettings [list $encryptTimeoutAttr $encryptTypeAttr $drsAttr $serializationAttr $poolAttr]]
set attrs [list $nameAttr $replicationSettingAttr]
set myReplicator [$AdminConfig create MultibrokerDomain $aCellParent $attrs]
} else {
# modify existing replicator properties
set replicatorSetting [$AdminConfig showAttribute $myReplicator defaultDataReplicationSettings]
$AdminConfig modify $replicatorSetting [list [list requestTimeout 10]]
set drsPartition [$AdminConfig showAttribute $replicatorSetting partition]
$AdminConfig modify $drsPartition [list [list size 15]]
}

# check if there is existing replicator entry named myBrokerEntry
set replicationEntries [lindex [$AdminConfig showAttribute $myReplicator entries] 0]
set foundEntry false
if {[llength $replicatorEntries] != 0} {
foreach aReplicatorEntry $replicatorEntries {
if {[$AdminConfig showAttribute $aReplicatorEntry brokerName] == "myBrokerEntry"} {
set foundEntry $aReplicatorEntry
break
}
}
}
if {$foundEntry == "false"} {
# create a replicator entry named myBrokerEntry
set nameAttr [list brokerName myBrokerEntry]
set clientHostAttr [list host myBrokerHost]
set clientPortAttr [list port 100]
set brokerHostAttr [list host myBrokerHost]
set brokerPortAttr [list port 101]
set clientAttr [list clientEndPoint [list $clientHostAttr $clientPortAttr]]
set brokerAttr [list brokerEndPoint [list $brokerHostAttr $brokerPortAttr]]
set attrs [list $nameAttr $clientAttr $brokerAttr]
$AdminConfig create MultiBrokerRoutingEntry $myReplicator $attrs

# configure server myServer to define this replicator entry
set domainAttr [list domainName myReplicator]
set brokerAttr [list brokerName myBrokerEntry]
set enableAttr [list enable true]
set attrs [list $domainAttr $brokerAttr $enableAttr]
set aServer [$AdminConfig getid /Node:myNode/Server:myServer/]
$AdminConfig create SystemMessageServer $aServer $attrs
} else {
# modify existing replicator entry value
set clientEndPoint [$AdminConfig showAttribute $foundEntry clientEndPoint]
$AdminConfig modify $clientEndPoint [list [list port 100]]
}

$AdminConfig save

#-------------------------------------------------------------------------
#-- Configuring namespace binding 
#-------------------------------------------------------------------------

set aCellParent [$AdminConfig getid /Cell:myCell/]
# string type name space binding
set aBinding1 [$AdminConfig getid /Cell:myCell/StringNameSpaceBinding:myBinding1/]
if {[llength $aBinding1] == 0} {
# create a string type name space binding
set nameAttr [list name myBinding1]
set nameSpaceAttr [list nameInNameSpace myBindings/myString]
set bindAttr [list stringToBind "String to bind"]
set attrs [list $nameAttr $nameSpaceAttr $bindAttr]
set aBinding1 [$AdminConfig create StringNameSpaceBinding $aCellParent $attrs]
} else {
# modify existing name space binding
set bindAttr [list stringToBind "new string to bind"]
set attrs [list $bindAttr]
$AdminConfig modify $aBinding1 $attrs
}

# EJB type name space binding
set aBinding2 [$AdminConfig getid /Cell:myCell/EjbNameSpaceBinding:myBinding2/]
# create an EJB type name space binding to a server
set nameAttr [list name myBinding2]
set nameSpaceAttr [list nameInNameSpace myBindings/myEJB]
set nodeAttr [list applicationNodeName myNode]
set serverNameAttr [list applicationServerName myServer]
set locationAttr [list bindingLocation SINGLESERVER]
set jndiNameAttr [list ejbJndiName ejb/myEJB]
set attrs [list $nameAttr $nameSpaceAttr $nodeAttr $serverNameAttr $locationAttr $jndiNameAttr]
set aBinding2 [$AdminConfig create EjbNameSpaceBinding $aCellParent $attrs]
} else {
# modify existing EJB type name space binding
set jndiNameAttr [list ejbJndiName ejb/myEJB]
set attrs [list $jndiName]
$AdminConfig modify $aBinding2 $attrs
}

set aBinding3 [$AdminConfig getid /Cell:myCell/EjbNameSpaceBinding:myBinding3/]
if {[llength $aBinding3] == 0} {
# create an EJB type name space binding to a cluster
set nameAttr [list name myBinding3]
set nameSpaceAttr [list nameInNameSpace myBindings/myEJB]
set serverNameAttr [list applicationServerName myCluster]
set locationAttr [list bindingLocation SERVERCLUSTER]
set jndiNameAttr [list ejbJndiName ejb/myEJB]
set attrs [list $nameAttr $nameSpaceAttr $serverNameAttr $locationAttr $jndiNameAttr]
set aBinding3 [$AdminConfig create EjbNameSpaceBinding $aCellParent $attrs]
} else {
# modify existing EJB type name space binding
set jndiNameAttr [list ejbJndiName ejb/myEJB]
set attrs [list $jndiName]
$AdminConfig modify $aBinding3 $attrs
}

# CORBA type name space binding
set aBinding4 [$AdminConfig getid /Cell:myCell/CORBAObjectNameSpaceBinding:myBinding4/]
if {[llength $aBinding4] == 0} {
# create a CORBA type name space binding
set nameAttr [list name myBinding4]
set nameSpaceAttr [list nameInNameSpace myBindings/myCORBA]
set urlAttr [list corbanameUrl corbaname:iiop:somehost.somecompany.com:2809#stuff/MyCORBAOjbect]
set contextAttr [list federatedContext false]
set attrs [list $nameAttr $nameSpaceAttr $urlAttr $contextAttr]
set aBinding4 [$AdminConfig create CORBAObjectNameSpaceBinding $aCellParent $attrs]
}

# indirect type name space binding
set aBinding5 [$AdminConfig getid /Cell:myCell/IndirectLookupNameSpaceBinding:myBinding5/]
if {[llength $aBinding5] == 0} {
# create an indirect type name space binding
set nameAttr [list name myBinding5]
set nameSpaceAttr [list nameInNameSpace myBindings/myIndirect]
set urlAttr [list providerURL corbaloc::myCompany.com:9809/NameServiceServerRoot]
set jndiNameAttr [list jndiName jndi/name/for/EJB]
set attrs [list $nameAttr $nameSpaceAttr $urlAttr $jndiNameAttr]
set aBinding5 [$AdminConfig create IndirectLookupNameSpaceBinding $aCellParent $attrs]
}

$AdminConfig save

#-------------------------------------------------------------------------
#-- Configuring CORBA naming service user 
#-------------------------------------------------------------------------

set roleAssignExts [$AdminConfig list RoleAssignmentExt]
# list all CORBA naming service users
foreach aRoleAssignExt $roleAssignExts {
set secRoleId [$AdminConfig showAttribute $aRoleAssignExt role]
# get the role name
set secRoleName [$AdminConfig showAttribute $secRoleId roleName]
if {$secRoleName == "CosNamingCreate" || $secRoleName == "CosNamingDelete" || $secRoleName == "CosNamingRead" || $secRoleName == "CosNamingWrite"} {
puts "Users with $secRoleName authority:"
set users [lindex [$AdminConfig showAttribute $aRoleAasignExt users] 0]
if {[llength $users] != 0} {
foreach aUser $users {
puts [$AdminConfig showAttribute $aUser name]
}
}
}
}
set username myCosNamingReadUser
# valid roles are CosNamingRead, CosNamingWrite, CosNamingCreate, CosNamginDelete
set rolePick CosNamingRead
# check whether user myCosNamingReadUser with Cos Naming Read authority already exists
set found false
set foundRoleAssignExt ""
foreach aRoleAssignExt $roleAssignExts {
set secRoleId [$AdminConfig showAttribute $aRoleAssignExt role]
# get the role name
set secRoleName [$AdminConfig showAttribute $secRoleId roleName]
if {$secRoleName == $rolePick} {
set foundRoleAssignExt $aRoleAssignExt
set users [lindex [$AdminConfig showAttribute $aRoleAssignExt users] 0]
foreach aUser $users {
# check if user already exists
if {[$AdminConfig showAttribute $aUser name] == $username} {
set found true
break
}
}
break
}
}

if {$found == "false"} {
# assuming myCosNamingReadUser is included in the active user registry
puts "Create a new user $username with $rolePick authority"
$AdminConfig create UserExt $foundRoleAssignExt [list [list name $username]]
}

# Found all the myCosNamingReadUser users and delete them
set deleteUser myCosNamingReadUser
foreach aRoleAssignExt $roleAssignExts {
set users [lindex [$AdminConfig showAttribute $aRoleAssignExt users] 0]
foreach aUser $users {
if {[$AdminConfig showAttribute $aUser name] == $deleteUser} {
puts "Removing $aUser"
$AdminConfig remove $aUser
}
}
}

$AdminConfig save
#-------------------------------------------------------------------------
#-- Configuring CORBA naming service group 
#-------------------------------------------------------------------------

set roleAssignExts [$AdminConfig list RoleAssignmentExt]
# list all CORBA naming service groups
foreach aRoleAssignExt $roleAssignExts {
set secRoleId [$AdminConfig showAttribute $aRoleAssignExt role]
# get the role name
set secRoleName [$AdminConfig showAttribute $secRoleId roleName]
if {$secRoleName == "CosNamingCreate" || $secRoleName == "CosNamingDelete" || $secRoleName == "CosNamingRead" || $secRoleName == "CosNamingWrite"} {
puts "Groups with $secRoleName authority:"
set groups [lindex [$AdminConfig showAttribute $aRoleAasignExt groups] 0]
if {[llength $groups] != 0} {
foreach aGroup $groups {
puts [$AdminConfig showAttribute àroup name]
}
}
}
}
set groupname myCosNamingDeleteGroup
# valid roles are CosNamingRead, CosNamingWrite, CosNamingCreate, CosNamginDelete
set rolePick CosNamingDelete
# check whether group myCosNamingDeleteGroup with Cos Naming Delete authority already exists
set found false
set foundRoleAssignExt ""
foreach aRoleAssignExt $roleAssignExts {
set secRoleId [$AdminConfig showAttribute $aRoleAssignExt role]
# get the role name
set secRoleName [$AdminConfig showAttribute $secRoleId roleName]
if {$secRoleName == $rolePick} {
set foundRoleAssignExt $aRoleAssignExt
set groups [lindex [$AdminConfig showAttribute $aRoleAssignExt groups] 0]
foreach aGroup $groups {
# check if group already exists
if {[$AdminConfig showAttribute àroup name] == $groupname} {
set found true
break
}
}
break
}
}

if {$found == "false"} {
# assuming myCosNamingDeleteGroup is included in the active user registry
puts "Create a new group $groupname with $rolePick authority"
$AdminConfig create GroupExt $foundRoleAssignExt [list [list name $groupname]]
}

# Found all the myCosNamingDeleteGroup group name and delete them
set deleteGroup myCosNamingDeleteGroup
foreach aRoleAssignExt $roleAssignExts {
set groups [lindex [$AdminConfig showAttribute $aRoleAssignExt groups] 0]
foreach aGroup $groups {
if {[$AdminConfig showAttribute àroup name] == $deleteGroup} {
puts "Removing àroup"
$AdminConfig remove àroup
}
}
}

$AdminConfig save

#-------------------------------------------------------------------------
#-- Configuring cell 
#-------------------------------------------------------------------------
set aCell [$AdminConfig getid /Cell:myCell/]
# modify cellDiscoveryProtocol to use UDP
$AdminConfig modify $aCell {{cellDiscoveryProtocol UDP}}
# create a custom property
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set requireAttr [list required false]
set typeAttr [list type java.lang.String]
set attrs [list $nameAttr $valueAttr $requireAttr $typeAttr]
$AdminConfig create TypedProperty $aCell $attrs

$AdminConfig save

#-------------------------------------------------------------------------
#-- Stopping deployment manager 
#-------------------------------------------------------------------------
set dmgr [$AdminControl queryNames type=Server,name=dmgr,*]
$AdminControl invoke $dmgr stop

#-------------------------------------------------------------------------
#-- Removing a node 
#-------------------------------------------------------------------------
set aNode [$AdminConfig getid /Node:myNode/]
$AdminConfig remove $aNode
$AdminConfig save

#--------------------------------------------------------------------------
#-- Synchronizing a node 
#--------------------------------------------------------------------------
set aRunningNodeSync [$AdminControl queryNames
  type=NodeSync,node=myNode,process=nodeagent,*]
  $AdminControl invoke $aRunningNodeSync sync

#--------------------------------------------------------------------------
#--Full synchronization of a node 
#--------------------------------------------------------------------------
 set aRunningConfigRepo [$AdminControl queryNames
  type=ConfigRepository,node=myNode,process=nodeagent,*]
  $AdminControl invoke $aRunningConfigRepo refresh RepositoryEpoch
  set aRunningNodeSync [$AdminControl queryNames
  type=NodeSync,node=myNode,process=nodeagent,*]
  $AdminControl invoke $aRunningNodeSync sync

#--------------------------------------------------------------------------
#--Stopping a node 
#--------------------------------------------------------------------------

set aRunningNode [$AdminControl queryNames
  type=Server,node=myNode,processType=NodeAgent,*]
  $AdminControl invoke $aRunningNode stop

#--------------------------------------------------------------------------
#-- Configuring general property of a node 
#--------------------------------------------------------------------------

set aNode [$AdminConfig getid /Node:myNode/]
  # valid values for discovery protocol are UDP, TCP, and MULTICAST
  $AdminConfig modify $aNode [list [list discoveryProtocol TCP]]
  $AdminConfig save

 
#--------------------------------------------------------------------------
#--Configuring custom properties of a node 
#--------------------------------------------------------------------------
set aNode [$AdminConfig getid /Node:myNode/]

set props [lindex [$AdminConfig showAttribute $aNode properties] 0]

# list all properties
if {[llength $props] != 0} {
puts "Existing properties:"
foreach aProp $props {
puts [$AdminConfig showall $aProp]
}
}

# look for property named property1
set found false
foreach aProp $props {
if {[$AdminConfig showAttribute $aProp name] == "property1"} {
set found $aProp
break
}
}

# if property1 is not found, create one
if {$found == "false"} {
puts "Create a new property"
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set attrs [list $nameAttr $valueAttr]
set prop [$AdminConfig create Property $aNode $attrs]
puts [$AdminConfig showall $prop]
}

$AdminConfig save
#--------------------------------------------------------------------------
#-- Stopping a node agent 
#--------------------------------------------------------------------------
set aRunningNodeAgent [$AdminControl queryNames
  type=NodeAgent,node=myNode,*]
   $AdminControl invoke $aRunningNodeAgent stopNode

#--------------------------------------------------------------------------
#-- Restarting a node agent 
#--------------------------------------------------------------------------
set aRunningNodeAgent [$AdminControl queryNames
  type=NodeAgent,node=myNode,*]
  $AdminControl invoke $aRunningNodeAgent restart {true true}
#--------------------------------------------------------------------------
#--Restarting all servers on a node 
#--------------------------------------------------------------------------
set runningServers [$AdminControl queryNames type=Server,node=myNode,type=ManagedProcess,*]
foreach aRunningServer $runningServers {
set name [$AdminControl getAttribute $aRunningServer name]
$AdminControl stopServer $name myNode
}

foreach aRunningServer $runningServers {
set name [$AdminControl getAttribute $aRunningServer name]
$AdminControl startServer $name myNode
}

#---------------------------------------------------------------------------
#-- Configuring file transfer service properties 
#---------------------------------------------------------------------------

set aNodeServer [$AdminConfig getid /Node:myNode/Server:nodeagent/]
# get configuration object for NodeAgent
set aNodeAgent [$AdminConfig list NodeAgent $aNodeServer]
set aFileTransferService [$AdminConfig showAttribute $aNodeAgent fileTransferService]
# modify general properties
set retriesCountAttr [list retriesCount 2]
# wait time is specified in number seconds
set retriesWaitAttr [list retryWaitTime 5]
set attrs [list $retriesCountAttr $retriesWaitAttr]
puts "Modify general properties for file transfer service"
$AdminConfig modify $aFileTransferService $attrs
puts [$AdminConfig show $aFileTransferService]
# add a new custom property
puts "Create a new property"
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set attrs [list $nameAttr $valueAttr]
set prop [$AdminConfig create Property $aFileTransferService $attrs]
puts [$AdminConfig showall $prop]

$AdminConfig save

#---------------------------------------------------------------------------
#-- Configuring file synchronization service properties 
#---------------------------------------------------------------------------
set aNodeServer [$AdminConfig getid /Node:myNode/Server:nodeagent/]
# get configuration object for NodeAgent
set aNodeAgent [$AdminConfig list NodeAgent $aNodeServer]
set aFileSyncService [$AdminConfig showAttribute $aNodeAgent fileSynchronizationService]
# modify general properties
set synchOnStartupAttr [list synchOnServerStartup true]
# synchronization interval is in number of minutes
set synchIntervalAttr [list synchInterval 2]
set attrs [list $synchOnStartupAttr $synchIntervalAttr]
puts "Modify general properties of a file synchronization service"
$AdminConfig modify $aFileSyncService $attrs
puts [$AdminConfig show $aFileSyncService]
# add a new custom property
puts "Create a new property"
set nameAttr [list name property1]
set valueAttr [list value property1Value]
set attrs [list $nameAttr $valueAttr]
set prop [$AdminConfig create Property $aFileSyncService $attrs]
puts [$AdminConfig showall $prop]
$AdminConfig save

#---------------------------------------------------------------------------
#-- Configuring diagnostic trace 
#---------------------------------------------------------------------------
# modify configuration trace spec property of diagnostic trace service for a server
set aServer [$AdminConfig getid /Server:myServer/]
set aTraceService [$AdminConfig list TraceService $aServer]
set specAttr [list startupTraceSpecification com.ibm.ws.management.*=all=enabled:com.ibm.websphere.management.*=all=enabled]
set attrs [list $specAttr]
$AdminConfig modify $aTraceService $attrs
$AdminConfig save
# modify runtime trace spec property for running object myServer
set aRunningTraceService [$AdminControl queryNames type=TraceService,process=myServer,*]
if {[llength $aRunningTraceService] != 0} {
$AdminControl setAttribute $aRunningTraceService traceSpecification com.ibm.ws.management.*=all=enabled
}

#---------------------------------------------------------------------------
#-- Configuring JVM logs 
#---------------------------------------------------------------------------
# modify configuration settings of JVM System.out and System.err logs for a server
set aServer [$AdminConfig getid /Node:myNode/Server:myServer/]
set outputStream [$AdminConfig showAttribute $aServer outputStreamRedirect]
# change the log file name
set fileNameAttr [list fileName \${SERVER_LOG_ROOT}/out.log]
# change the rotation file size to 2 MB
set rolloverSizeAttr [list rolloverSize 2]
# change rotation policy based on time
set rolloverTypeAttr [list rolloverType TIME]
set rolloverPeriodAttr [list rolloverPeriod 12]
set baseHourAttr [list baseHour 24]
# suppress formatting
set formatAttr [list formatWrites false]
set attrs [list $fileNameAttr $rolloverSizeAttr $rolloverTypeAttr $rolloverPeriodAttr $baseHourAttr $formatAttr]
$AdminConfig modify $outputStream $attrs
set errorStream [$AdminConfig showAttribute $aServer errorStreamRedirect]
# change the log file name
set fileNameAttr [list fileName \${SERVER_LOG_ROOT}/err.log]
# change number of history log files
set backupAttr [list maxNumberOfBackupFiles 2]
set attrs [list $fileNameAttr $backupAttr]
$AdminConfig modify $errorStream $attrs
$AdminConfig save

#---------------------------------------------------------------------------
#-- Configuring process logs 
#---------------------------------------------------------------------------
# modify configuration setting for files that stdout and stderr streams write
set aServer [$AdminConfig getid /Node:myNode/Server:myServer/]
set outputRedirect [$AdminConfig list OutputRedirect $aServer]
set errAttr [list stderrFilename \ ${SERVER_LOG_ROOT}/nativeStderr.log]
set outAttr [list stdoutFilename \$ {SERVER_LOG_ROOT}/nativeStdout.log]
set attrs [list $errAttr $outAttr]
$AdminConfig modify $outputRedirect $attrs
$AdminConfig save

#---------------------------------------------------------------------------
#-- Configuring activity log 
#---------------------------------------------------------------------------

set aServer [$AdminConfig getid /Node:myNode/Server:myServer/]
set loggingService [$AdminConfig list RASLoggingService $aServer]
# change to disable correlation ID
set correlationAttr [list enableCorrelationId false]
# change message filtering to log service, warning, error
set filterAttr [list messageFilterLevel SERVICE]
# change the service log size to 4 MB
set sizeAttr [list size 4]
set attrs [list $correlationAttr $filterAttr]
$AdminConfig modify $loggingService $attrs
set serviceLog [$AdminConfig showAttribute $loggingService serviceLog]
set attrs [list $sizeAttr]
$AdminConfig modify $serviceLog $attrs
$AdminConfig save

#---------------------------------------------------------------------------
#-- Configuring document validation 
#---------------------------------------------------------------------------
$AdminConfig setValidationLevel MEDIUM
  $AdminConfig setCrossDocumentValidationEnabled true
  $AdminConifg validate

#---------------------------------------------------------------------------
#-- Configuring PMI request metrics 
#---------------------------------------------------------------------------

set aPMI [$AdminConfig list PMIRequestMetrics]
# change to enable PMI request metrics
set enableAttr [list enable true]
# change to have full detail trace
set traceAttr [list traceLevel DEBUG]
set attrs [list $enableAttr $traceAttr]
$AdminConfig modify $aPMI $attrs
# list existing filters
set filters [lindex [$AdminConfig showAttribute $aPMI filters] 0]
foreach aFilter $filters {
puts "Filter type: [$AdminConfig showAttribute $aFilter type]"
puts " enabled: [$AdminConfig showAttribute $aFilter enable]"
set filterValues [lindex [$AdminConfig showAttribute $aFilter filterValues] 0]
foreach aFilterValue $filterValues {
puts " filter value: [$AdminConfig showAttribute $aFilterValue value]"
puts " enable: [$AdminConfig showAttribute $aFilterValue enable]"
}
}

$AdminConfig save

Leave a Reply