# 要求本机装有weblogic能正常运行~!~......
#运行方式为:
# $weblogicDir$/common/bin/wlst.cmd 本文件路径 以.py结尾
#创建域
#然后在此域下创建jndi 并关联
#[]内容为变量
#=======================================================================================
# Create a domain.
#=======================================================================================
createDomain(\'[weblogicDir]/common/templates/domains/wls.jar\',\'[appDir]\', \'weblogic\', \'[domainAdminPassword]\')
#=======================================================================================
# Open a domain.
#=======================================================================================
readDomain(\'[appDir]\')
#=======================================================================================
# Set a domain name.
#=======================================================================================
set(\'Name\',\'xf_domain\')
#=======================================================================================
# Configure the Administration Server and SSL port.
#
# To enable access by both local and remote processes, you should not set the
# listen address for the server instance (that is, it should be left blank or not set).
# In this case, the server instance will determine the address of the machine and
# listen on it.
#=======================================================================================
cd(\'Servers/AdminServer\')
set(\'ListenAddress\',\'\')
set(\'ListenPort\', [weblogicPort])
#===========================================================
# Create and configure a JDBC Data Source, and sets the JDBC user.
#===========================================================
cd(\'/\')
create(\'db_xf\', \'JDBCSystemResource\')
cd(\'JDBCSystemResource/db_xf/JdbcResource/db_xf\')
create(\'db_xf\',\'JDBCDriverParams\')
cd(\'JDBCDriverParams/NO_NAME_0\')
set(\'DriverName\',\'com.microsoft.sqlserver.jdbc.SQLServerDriver\')
set(\'URL\',\'jdbc:sqlserver://[DBHOST]:[DBPORT];DatabaseName=[DBNAME]\')
set(\'PasswordEncrypted\', \'[DBUSERPWD]\')
set(\'UseXADataSourceInterface\', \'false\')
create(\'db_xf\',\'Properties\')
cd(\'Properties/NO_NAME_0\')
create(\'User\', \'Property\')
cd(\'Property/User\')
cmo.setValue(\'[DBUSER]\')
cd(\'/JDBCSystemResource/db_xf/JdbcResource/db_xf\')
create(\'db_xf\',\'JDBCDataSourceParams\')
cd(\'JDBCDataSourceParams/NO_NAME_0\')
set(\'JNDIName\', java.lang.String("jdbc/db_xf"))
cd(\'/JDBCSystemResource/db_xf/JdbcResource/db_xf\')
create(\'db_xf\',\'JDBCConnectionPoolParams\')
cd(\'JDBCConnectionPoolParams/NO_NAME_0\')
set(\'TestTableName\',\'SQL SELECT 1\')
set(\'ConnectionReserveTimeoutSeconds\', 25)
set(\'InitialCapacity\', 50)
set(\'MaxCapacity\', 300)
set(\'CapacityIncrement\', 50)
set(\'StatementCacheSize\', 30)
set(\'InactiveConnectionTimeoutSeconds\', 30)
#===========================================================
# Target resources to the servers.
#===========================================================
cd(\'/\')
assign(\'JDBCSystemResource\', \'db_xf\', \'Target\', \'AdminServer\')
#=======================================================================================
# update the domain and close the domain.
#=======================================================================================
updateDomain()
closeDomain()
#=======================================================================================
# Exit WLST.
#=======================================================================================
exit()