Create a new data source custom property using wsadmin
set newds [$AdminConfig getid /Cell:cell/Node:node/JDBCProvider:JDBCProvider/DataSource:DS/]
set propSet [$AdminConfig showAttribute $newds propertySet]
$AdminConfig required J2EEResourceProperty
set name [list name RP4]
set rpAttrs [list $name]
$AdminConfig create J2EEResourceProperty $propSet $rpAttrs
$AdminConfig save
Using Jython
### Identify the parent ID...
newds = AdminConfig.getid('/Cell:cell/Node:node/JDBCProvider:JDBCProvider/DataSource:DS/')
print newds
### Get the J2EE resource property set...
propSet = AdminConfig.showAttribute(newds, 'propertySet')
print propSet
### Get required attribute...
print AdminConfig.required('J2EEResourceProperty')
### Set up attributes...
name = ['name', 'RP4']
rpAttrs = [name]
### Create a J2EE resource property...
print AdminConfig.create('J2EEResourceProperty', propSet, rpAttrs)
AdminConfig.save()
Modify datasource custom properties using wsadmin
Using Jacl
### Identify the datasource and assign it to the ds variable, for
set ds [$AdminConfig list DataSource myDataSource]
### Obtain a list of existing custom properties...
set ps [$AdminConfig showAttribute $ds propertySet]
### Modify the property value...
foreach rp $rps {
if {[regexp databaseName $rp] == 1} {
$AdminConfig modify $rp {{value newDatabaseName}}
}
}
set rps [lindex [$AdminConfig showAttribute $ps resourceProperties] 0]
$AdminConfig save
Using Jython
ds = AdminConfig.list('DataSource', 'myDataSource')
print ds
ps = AdminConfig.showAttribute(ds, 'propertySet')
print ps
rps = AdminConfig.showAttribute(ps, 'resourceProperties')
print rps
rpsarray = rps[1:len(rps)-1].split(' ') for rp in rpsarray...
name = AdminConfig.showAttribute(rp, 'name')
if name == 'databaseName'...
AdminConfig.modify(rp, [['value', 'newvalue']])
AdminConfig.save()