<< German moms and pops pay for your kids' | Home | enable the automatic synchronisation of the nodes >>

WAS Jython scripting 20091013

... sticky note on importing Admin objects


The first, not so nice way:

import com.ibm.ws.scripting.AdminConfigClient as AConfig
AdminConfig = AConfig.getInstance()
import com.ibm.ws.scripting.AdminAppClient as AApp
AdminApp = AApp.getInstance()
import com.ibm.ws.scripting.AdminControlClient as AControl
AdminControl = AControl.getInstance()

For AdminTask this does not work.

The second, really wonderful way:

sys.modules['AdminApp'] = AdminApp
sys.modules['AdminConfig'] = AdminConfig
sys.modules['AdminControl'] = AdminControl
sys.modules['AdminTask'] = AdminTask

sys.modules['Help'] = Help

And now do simple imports on the objects ;-)

There is also another quite interesting article about:
Using the full potential of Jython to build compact and maintainable wsadmin scripts



Add a comment Send a TrackBack