• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Need help in fetching connectionTimeout value for datasources, using jython scripting

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#-------------------------------------------------------------------------------
import sys
global AdminConfig
global AdminControl
lineSeparator = java.lang.System.getProperty('line.separator')

#-------------------------------------------------------------------------------
# updateDataSource(scope,params)
# update connection timeout value for all datasources
#-------------------------------------------------------------------------------

def updateDataSource(scope,params):
dataSources = AdminConfig.list('DataSource', AdminConfig.getid(scope))
if len(dataSources) > 0:
dsList = dataSources.split(lineSeparator)
for ds in dsList:
dsName = AdminConfig.showAttribute(ds, "name")
if dsName != "DefaultEJBTimerDataSource":
print AdminConfig.showall(ds) ####### It shows everything, but I only need connectionTimeout value
AdminConfig.modify(ds, params)
print " Modified datasource: " + dsName

#endDef
#-----------------------------------------------------------------




OUTPUT for AdminConfig.showall():

[authMechanismPreference BASIC_PASSWORD]
[category default]
[connectionPool [[agedTimeout []]
[connectionTimeout 1000]
[maxConnections 30]
[minConnections 1]
[purgePolicy FailingConnectionOnly]
[reapTime 180]
[unusedTimeout 1800]]]
...........................
....................
.............
.......
..




Hi friends,

I have developed the above script to modify connectionTimeout value for all datasources in a specified scope. Before modifying the values I want the script to fetch and show current values for backout purpose, but facing issues in fetching connectionTimeout value. AdminConfig.showall() can fetch everything but I want only value for connectionTimeout which is 1000 here. Can anyone give me a quick solution as this is very urgent for me. Thanks in advance.
 
    Bookmark Topic Watch Topic
  • New Topic