Sunday, November 13, 2011

Jython Script to check the status of listener ports of all servers of cluster

lineSeparator = java.lang.System.getProperty('line.separator')

clusterName='CLUSTER_NAME'
cId = AdminConfig.getid("/ServerCluster:"+ clusterName +"/" )
cList = AdminConfig.list("ClusterMember", cId ).split(lineSeparator)
for sId in cList:
server = AdminConfig.showAttribute(sId, "memberName" )
node = AdminConfig.showAttribute(sId, "nodeName" )
cell = AdminControl.getCell()

s1 = AdminControl.completeObjectName('cell='+ cell +',node='+node +',name='+ server +',type=Server,*')
if len(s1) > 0:
print server + " state is started"
else:
print server + " is down"

print "Server " + server + " has the following Listener Ports"
lPorts = AdminControl.queryNames('type=ListenerPort,cell='+ cell+',node='+ node +',process='+ server +',*')
lPortsArray = lPorts.split(lineSeparator)
for lPort in lPortsArray:
lpcfgId = AdminControl.getConfigId(lPort)
lpName = AdminConfig.showAttribute(lpcfgId, "name")
lpstate = AdminControl.getAttribute(lPort, 'started')
if lpstate == 'true':
print lpName + " is started "
else :
print lpName + " is stopped "

print ""

Jython script to create Variable at Cluster Scope

import sys,java
from java.util import Properties
from org.python.modules import time
from java.io import FileInputStream

lineSep = java.lang.System.getProperty('line.separator')


def variable(cluster,varname1,varvalue1):

global AdminApp
global AdminConfig
global AdminControl

print " ----------------------------------------------------------------------------------------- "

######################################## Getting config ID of cell ################################################

cell = AdminControl.getCell()

cellid = AdminConfig.getid('/Cell:'+ cell)

Clusterid = AdminConfig.getid('/ServerCluster:'+ cluster +'/')

varMapserver = AdminConfig.getid('/ServerCluster:'+ cluster +'/VariableMap:/')

if len(varMapserver) > 0:

print " Variable Map exists on Cluster ........... "

variables = AdminConfig.list("VariableSubstitutionEntry", varMapserver).split(lineSeparator)
for variable in variables[:]:
vname = AdminConfig.showAttribute(variable, "symbolicName")
if (vname == varname1) :
print "Removing old variable " + vname + " from variables.xml..."
AdminConfig.remove(variable)

nameattr1 = ['symbolicName', varname1]
valattr1 = ['value', varvalue1]
desc1 = ["description", varname1]
attr1 = [nameattr1, valattr1, desc1]
attrs1 = [attr1]

entries1 = ['entries', attrs1 ]

print "creating new variable " + varname1

AdminConfig.modify(varMapserver, [entries1] )

print " Cluster Level Variable Configured ................ "

print " ------------------------------------------------------------------------------------------------------------------------ "


else:

print " Variable Map doesn't exists on Cluster ........... "

varMapserver = AdminConfig.create('VariableMap', Clusterid, [])

print " Variable Map created on Cluster ........... "

nameattr1 = ['symbolicName', varname1]
valattr1 = ['value', varvalue1]
desc1 = ["description", varname1]
attr1 = [nameattr1, valattr1, desc1]
attrs1 = [attr1]

entries1 = ['entries', attrs1 ]

print "creating new variable " + varname1

AdminConfig.modify(varMapserver, [entries1] )

print " Cluster Level Variable Configured ................ "

print " ------------------------------------------------------------------------------------------------------------------------ "


AdminConfig.save()

######################################################### Full Resyncronization #########################################################

print " Fully Resyncronizing nodes ........... "

nodelist = AdminTask.listManagedNodes().split(lineSep)

for nodename in nodelist :

####################Identifying the ConfigRepository MBean and assign it to variable######################

repo = AdminControl.completeObjectName('type=ConfigRepository,process=nodeagent,node='+ nodename +',*')

print AdminControl.invoke(repo, 'refreshRepositoryEpoch')

sync = AdminControl.completeObjectName('cell='+ cell +',node='+ nodename +',type=NodeSync,*')

print AdminControl.invoke(sync , 'sync')

print " ----------------------------------------------------------------------------------------- "

print " Full Resyncronization completed "

print " ----------------------------------------------------------------------------------------- "


########################################################## Main Program #############################################################

arglen=len(sys.argv)

num_exp_args=2

if (arglen != num_exp_args):

print "Two arguments are required."

print " ----------------------------------------------------------------------------------------- "

sys.exit(-1)

propFile=sys.argv[0]

properties=Properties();

try:

properties.load(FileInputStream(propFile))

print " ----------------------------------------------------------------------------------------- "

print "Succesfully read property file "+propFile

print " ----------------------------------------------------------------------------------------- "

except:

print "Cannot read property file "+propFile
sys.exit(-1)

print " ----------------------------------------------------------------------------------------- "


cluster = sys.argv[1]
varname1=str(properties.getProperty("VARIABLE_NAME"))
varvalue1=str(properties.getProperty("VARIABLE_VALUE"))

variable(cluster,varname1,varvalue1)

Jython Script to create variable at Node Scope

import sys,java
from java.util import Properties
from org.python.modules import time
from java.io import FileInputStream

lineSep = java.lang.System.getProperty('line.separator')


def variable(node,varname1,varvalue1):

global AdminApp
global AdminConfig
global AdminControl

print " ----------------------------------------------------------------------------------------- "



cell = AdminControl.getCell()

cellid = AdminConfig.getid('/Cell:'+ cell)




nodeid= AdminConfig.getid('/Cell:'+ cell +'/Node:'+ node +'/')

varMapserver = AdminConfig.getid('/Cell:'+ cell +'/Node:'+ node +'/VariableMap:/')

if len(varMapserver) > 0:

print " Variable Map exists on node ........... "

variables = AdminConfig.list("VariableSubstitutionEntry", varMapserver).split(lineSeparator)
for variable in variables[:]:
vname = AdminConfig.showAttribute(variable, "symbolicName")
if (vname == varname1) :
print "Removing old variable " + vname + " from variables.xml..."
AdminConfig.remove(variable)

nameattr1 = ['symbolicName', varname1]
valattr1 = ['value', varvalue1]
desc1 = ["description", varname1]
attr1 = [nameattr1, valattr1, desc1]
attrs1 = [attr1]

entries1 = ['entries', attrs1 ]

print "creating new variable " + varname1

AdminConfig.modify(varMapserver, [entries1] )

AdminConfig.save()

print " Node Level Variable Configured ................ "

print " ------------------------------------------------------------------------------------------------------------------------ "

else:

print " Variable Map doesn't exists on node ........... "

varMapserver = AdminConfig.create('VariableMap', nodeid, [])

print " Variable Map created on node ........... "

nameattr1 = ['symbolicName', varname1]
valattr1 = ['value', varvalue1]
desc1 = ["description", varname1]
attr1 = [nameattr1, valattr1, desc1]
attrs1 = [attr1]

entries1 = ['entries', attrs1 ]

print "creating new variable " + varname1

AdminConfig.modify(varMapserver, [entries1] )

AdminConfig.save()

print " Node Level Variable Configured ................ "

print " ------------------------------------------------------------------------------------------------------------------------ "




######################################################### Full Resyncronization #########################################################

print " Fully Resyncronizing nodes ........... "

nodelist = AdminTask.listManagedNodes().split(lineSep)

for nodename in nodelist :

####################Identifying the ConfigRepository MBean and assign it to variable######################

repo = AdminControl.completeObjectName('type=ConfigRepository,process=nodeagent,node='+ nodename +',*')

print AdminControl.invoke(repo, 'refreshRepositoryEpoch')

sync = AdminControl.completeObjectName('cell='+ cell +',node='+ nodename +',type=NodeSync,*')

print AdminControl.invoke(sync , 'sync')

print " ----------------------------------------------------------------------------------------- "

print " Full Resyncronization completed "

print " ----------------------------------------------------------------------------------------- "


########################################################## Main Program #############################################################

arglen=len(sys.argv)

num_exp_args=2

if (arglen != num_exp_args):

print "Two arguments are required."

print " ----------------------------------------------------------------------------------------- "

sys.exit(-1)

propFile=sys.argv[0]

properties=Properties();

try:

properties.load(FileInputStream(propFile))

print " ----------------------------------------------------------------------------------------- "

print "Succesfully read property file "+propFile

print " ----------------------------------------------------------------------------------------- "

except:

print "Cannot read property file "+propFile
sys.exit(-1)

print " ----------------------------------------------------------------------------------------- "


node = sys.argv[1]
varname1=str(properties.getProperty("VARIABLE_NAME"))
varvalue1=str(properties.getProperty("VARIABLE_VALUE"))

variable(node,varname1,varvalue1)

Jython Script to creating queue destination at cluster scope.

import sys,java
from java.util import Properties
from java.io import FileInputStream
from org.python.modules import time
lineSep = java.lang.System.getProperty('line.separator')

def QF(cluster,qmanager,jndiname,queue_name,target,name):

# Declare global variables

global AdminConfig
global AdminControl

# Gets the name of cell

cell = AdminControl.getCell()

cellid = AdminConfig.getid('/Cell:'+ cell +'/')

print " ----------------------------------------------------------------------------------------- "


Serverid = AdminConfig.getid('/Cell:'+ cell +'/ServerCluster:'+ cluster +'/')


#------QueueConnectionFactory--------#

MS=AdminConfig.getid('/ServerCluster:'+ cluster +'/JMSProvider:WebSphere MQ JMS Provider/')

QD=AdminConfig.getid('/ServerCluster:'+ cluster +'/JMSProvider:WebSphere MQ JMS Provider/MQQueue:'+ name +'/')

if len(QD) == 0 :
print "Queue does not exists .... "
else :
print "Queue exists, so removing old Queue ... "
AdminConfig.remove(QD)
print "Queue removed .. "


print "Creating Queue Destination .. "

name1 = ["name" , name]

jndi = ["jndiName" , jndiname ]

qm = ["baseQueueManagerName", qmanager ]

queue = ["baseQueueName", queue_name ]

target = ["targetClient", target ]

qd_attr = [name1 , jndi , qm , queue , target ]

newqf = AdminConfig.create('MQQueue' , MS , qd_attr)

print "Queue Destination created .. "

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- "




#--------------------------------------------------------------#


## Full Syncronization ##

print " Syncronizing configuration with Master Repository "

nodelist = AdminTask.listManagedNodes().split(lineSep)

for nodename in nodelist :

print " syncronizing nodes .......... "

####################Identifying the ConfigRepository MBean and assign it to variable######################

repo = AdminControl.completeObjectName('type=ConfigRepository,process=nodeagent,node='+ nodename +',*')

AdminControl.invoke(repo, 'refreshRepositoryEpoch')

sync = AdminControl.completeObjectName('cell='+ cell +',node='+ nodename +',type=NodeSync,*')

print AdminControl.invoke(sync , 'sync')

print " ----------------------------------------------------------------------------------------- "

print " ----------------------------------------------------------------------------------------- "

####################################################################################################################

#main program starts here

cluster = sys.argv[0]
target = sys.argv[1]
jndiname = sys.argv[2]
queue_name = sys.argv[3]
name=sys.argv[4]
qmanager = sys.argv[5]

QF(cluster,qmanager,jndiname,queue_name,target,name)

Jython script to create queue connection factory at cluster scope and configuring session pool and connection pool

import sys,java
from java.util import Properties
from java.io import FileInputStream
from org.python.modules import time
lineSep = java.lang.System.getProperty('line.separator')

def QF(cluster,timeOut,maxConn,minConn,reapTime,unusdTimeout,agedTimeout,StimeOut,SmaxConn,SminConn,SreapTime,SunusdTimeout,SagedTimeout,name,jndiname,xa,fail,auth_name,msg,pool,qmanager,rescan,tptype,connpool,purge,Spurge,mapping):

# Declare global variables

global AdminConfig
global AdminControl

# Gets the name of cell

cell = AdminControl.getCell()

cellid = AdminConfig.getid('/Cell:'+ cell +'/')

print " ----------------------------------------------------------------------------------------- "


Serverid = AdminConfig.getid('/Cell:'+ cell +'/ServerCluster:'+ cluster +'/')


#------QueueConnectionFactory--------#

MS=AdminConfig.getid('/ServerCluster:'+ cluster +'/JMSProvider:WebSphere MQ JMS Provider/')

QF=AdminConfig.getid('/ServerCluster:'+ cluster +'/JMSProvider:WebSphere MQ JMS Provider/MQQueueConnectionFactory:'+ name +'/')

if len(QF) == 0 :
print "QueueConnectionFactory does not exists .... "
else :
print "QueueConnectionFactory exists, so removing old QueueConnectionFactory ... "
AdminConfig.remove(QF)
print "QueueConnectionFactory removed .. "


print "Creating QueueConnectionFactory .. "

name1 = ["name" , name]

jndi = ["jndiName" , jndiname ]

XA = ["XAEnabled", xa ]

fail = ["failIfQuiesce", fail ]

auth = ["authMechanismPreference", auth_name]

msgreten = ["msgRetention", msg]

pool_int = ["pollingInterval", pool ]

qm = ["queueManager", qmanager ]

rscan = ["rescanInterval", rescan ]

tp = ["transportType", tptype]

map_configalias_attr = ["mappingConfigAlias", mapping]

map_attrs=[map_configalias_attr]

mapping_attr=["mapping", map_attrs]

conn = ["useConnectionPooling", connpool]

timeout = ["connectionTimeout" , timeOut]

maxconn = ["maxConnections" , maxConn]

minconn = ["minConnections" , minConn]

reaptime = ["reapTime" , reapTime]

unusedtimeout = ["unusedTimeout" , unusdTimeout]

agedtimeout = ["agedTimeout" , agedTimeout]

purgepolicy = ["purgePolicy" , purge]

connPoolAttrs = [timeout , maxconn , minconn , reaptime , unusedtimeout , agedtimeout , purgepolicy]

conn_pool = ["connectionPool", connPoolAttrs ]

Stimeout = ["connectionTimeout" , StimeOut]

Smaxconn = ["maxConnections" , SmaxConn]

Sminconn = ["minConnections" , SminConn]

Sreaptime = ["reapTime" , SreapTime]

Sunusedtimeout = ["unusedTimeout" , SunusdTimeout]

Sagedtimeout = ["agedTimeout" , SagedTimeout]

Spurgepolicy = ["purgePolicy" , Spurge]

sessPoolAttrs = [Stimeout , Smaxconn , Sminconn , Sreaptime , Sunusedtimeout , Sagedtimeout , Spurgepolicy]

sess_pool = ["sessionPool", sessPoolAttrs ]

qf_attr = [name1 , jndi , XA , fail , auth , mapping_attr ,msgreten ,pool_int , qm, rscan , tp , conn , conn_pool, sess_pool]

newqf = AdminConfig.create('MQQueueConnectionFactory' , MS , qf_attr)

print "QueueConnectionFactory created .. "

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- "




#--------------------------------------------------------------#


## Full Syncronization ##

print " Syncronizing configuration with Master Repository "

nodelist = AdminTask.listManagedNodes().split(lineSep)

for nodename in nodelist :

print " syncronizing nodes .......... "

####################Identifying the ConfigRepository MBean and assign it to variable######################

repo = AdminControl.completeObjectName('type=ConfigRepository,process=nodeagent,node='+ nodename +',*')

AdminControl.invoke(repo, 'refreshRepositoryEpoch')

sync = AdminControl.completeObjectName('cell='+ cell +',node='+ nodename +',type=NodeSync,*')

print AdminControl.invoke(sync , 'sync')

print " ----------------------------------------------------------------------------------------- "

print " ----------------------------------------------------------------------------------------- "

####################################################################################################################

#main program starts here

arglen=len(sys.argv)

num_exp_args=3

if (arglen != num_exp_args):

print "Three arguments are required.one of them is property file"

print " ----------------------------------------------------------------------------------------- "

sys.exit(-1)

propFile=sys.argv[0]

properties=Properties();

try:

properties.load(FileInputStream(propFile))

print " ----------------------------------------------------------------------------------------- "

print "Succesfully read property file "+propFile

print " ----------------------------------------------------------------------------------------- "

except:

print "Cannot read property file "+propFile
sys.exit(-1)

print " ----------------------------------------------------------------------------------------- "

cluster = sys.argv[1]
timeOut = int(properties.getProperty("Connection_timeout"))
maxConn = int(properties.getProperty("Maximum_connections"))
minConn = int(properties.getProperty("Minimum_connections"))
reapTime = int(properties.getProperty("Reap_time"))
unusdTimeout = int(properties.getProperty("Unused_timeout"))
agedTimeout = int(properties.getProperty("Aged_timeout"))
StimeOut = int(properties.getProperty("SConnection_timeout"))
SmaxConn = int(properties.getProperty("SMaximum_connections"))
SminConn = int(properties.getProperty("SMinimum_connections"))
SreapTime = int(properties.getProperty("SReap_time"))
SunusdTimeout = int(properties.getProperty("SUnused_timeout"))
SagedTimeout = int(properties.getProperty("SAged_timeout"))
name = str(properties.getProperty("Name"))
jndiname = str(properties.getProperty("Jndi_Name"))
xa = str(properties.getProperty("XAEnabled"))
fail = str(properties.getProperty("Enable-return-methods-during-shutdown"))
auth_name = str(properties.getProperty("authMechanismPreference"))
msg = str(properties.getProperty("Msg-Retention"))
pool = str(properties.getProperty("Polling-Interval"))
qmanager = sys.argv[2]
rescan = str(properties.getProperty("Rescan-Interval"))
tptype = str(properties.getProperty("TransportType"))
connpool = str(properties.getProperty("useConnectionPooling"))
purge = str(properties.getProperty("Purge_policy"))
Spurge = str(properties.getProperty("SPurge_policy"))
mapping = str(properties.getProperty("Mapping-configuration-alias"))

QF(cluster,timeOut,maxConn,minConn,reapTime,unusdTimeout,agedTimeout,StimeOut,SmaxConn,SminConn,SreapTime,SunusdTimeout,SagedTimeout,name,jndiname,xa,fail,auth_name,msg,pool,qmanager,rescan,tptype,connpool,purge,Spurge,mapping)

Jython script to create queue connection factory at node scope

import sys,java
from java.util import Properties
from java.io import FileInputStream
from org.python.modules import time
lineSep = java.lang.System.getProperty('line.separator')

def QF(node,timeOut,maxConn,minConn,reapTime,unusdTimeout,agedTimeout,StimeOut,SmaxConn,SminConn,SreapTime,SunusdTimeout,SagedTimeout,name,jndiname,xa,fail,auth_name,msg,pool,qmanager,rescan,tptype,connpool,purge,Spurge,mapping):

# Declare global variables

global AdminConfig
global AdminControl

# Gets the name of cell

cell = AdminControl.getCell()

cellid = AdminConfig.getid('/Cell:'+ cell +'/')

print " ----------------------------------------------------------------------------------------- "


#------QueueConnectionFactory--------#

MS=AdminConfig.getid('/Cell:'+ cell +'/Node:'+ node +'/JMSProvider:WebSphere MQ JMS Provider/')

QF=AdminConfig.getid('/Cell:'+ cell +'/Node:'+ node +'/JMSProvider:WebSphere MQ JMS Provider/MQQueueConnectionFactory:'+ name +'/')

if len(QF) == 0 :
print "QueueConnectionFactory does not exists .... "
else :
print "QueueConnectionFactory exists, so removing old QueueConnectionFactory ... "
AdminConfig.remove(QF)
print "QueueConnectionFactory removed .. "


print "Creating QueueConnectionFactory .. "

name1 = ["name" , name]

jndi = ["jndiName" , jndiname ]

XA = ["XAEnabled", xa ]

fail = ["failIfQuiesce", fail ]

auth = ["authMechanismPreference", auth_name]

msgreten = ["msgRetention", msg]

pool_int = ["pollingInterval", pool ]

qm = ["queueManager", qmanager ]

rscan = ["rescanInterval", rescan ]

tp = ["transportType", tptype]

map_configalias_attr = ["mappingConfigAlias", mapping]

map_attrs=[map_configalias_attr]

mapping_attr=["mapping", map_attrs]

conn = ["useConnectionPooling", connpool]

timeout = ["connectionTimeout" , timeOut]

maxconn = ["maxConnections" , maxConn]

minconn = ["minConnections" , minConn]

reaptime = ["reapTime" , reapTime]

unusedtimeout = ["unusedTimeout" , unusdTimeout]

agedtimeout = ["agedTimeout" , agedTimeout]

purgepolicy = ["purgePolicy" , purge]

connPoolAttrs = [timeout , maxconn , minconn , reaptime , unusedtimeout , agedtimeout , purgepolicy]

conn_pool = ["connectionPool", connPoolAttrs ]

Stimeout = ["connectionTimeout" , StimeOut]

Smaxconn = ["maxConnections" , SmaxConn]

Sminconn = ["minConnections" , SminConn]

Sreaptime = ["reapTime" , SreapTime]

Sunusedtimeout = ["unusedTimeout" , SunusdTimeout]

Sagedtimeout = ["agedTimeout" , SagedTimeout]

Spurgepolicy = ["purgePolicy" , Spurge]

sessPoolAttrs = [Stimeout , Smaxconn , Sminconn , Sreaptime , Sunusedtimeout , Sagedtimeout , Spurgepolicy]

sess_pool = ["sessionPool", sessPoolAttrs ]

qf_attr = [name1 , jndi , XA , fail , auth , mapping_attr ,msgreten ,pool_int , qm, rscan , tp , conn , conn_pool, sess_pool]

newqf = AdminConfig.create('MQQueueConnectionFactory' , MS , qf_attr)

print "QueueConnectionFactory created .. "

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- "




#--------------------------------------------------------------#


## Full Syncronization ##

print " Syncronizing configuration with Master Repository "

nodelist = AdminTask.listManagedNodes().split(lineSep)

for nodename in nodelist :

print " syncronizing nodes .......... "

####################Identifying the ConfigRepository MBean and assign it to variable######################

repo = AdminControl.completeObjectName('type=ConfigRepository,process=nodeagent,node='+ nodename +',*')

AdminControl.invoke(repo, 'refreshRepositoryEpoch')

sync = AdminControl.completeObjectName('cell='+ cell +',node='+ nodename +',type=NodeSync,*')

print AdminControl.invoke(sync , 'sync')

print " ----------------------------------------------------------------------------------------- "

print " ----------------------------------------------------------------------------------------- "

####################################################################################################################

#main program starts here

arglen=len(sys.argv)

num_exp_args=3

if (arglen != num_exp_args):

print "Three arguments are required.one of them is property file"

print " ----------------------------------------------------------------------------------------- "

sys.exit(-1)

propFile=sys.argv[0]

properties=Properties();

try:

properties.load(FileInputStream(propFile))

print " ----------------------------------------------------------------------------------------- "

print "Succesfully read property file "+propFile

print " ----------------------------------------------------------------------------------------- "

except:

print "Cannot read property file "+propFile
sys.exit(-1)

print " ----------------------------------------------------------------------------------------- "

node = sys.argv[1]
timeOut = int(properties.getProperty("Connection_timeout"))
maxConn = int(properties.getProperty("Maximum_connections"))
minConn = int(properties.getProperty("Minimum_connections"))
reapTime = int(properties.getProperty("Reap_time"))
unusdTimeout = int(properties.getProperty("Unused_timeout"))
agedTimeout = int(properties.getProperty("Aged_timeout"))
StimeOut = int(properties.getProperty("SConnection_timeout"))
SmaxConn = int(properties.getProperty("SMaximum_connections"))
SminConn = int(properties.getProperty("SMinimum_connections"))
SreapTime = int(properties.getProperty("SReap_time"))
SunusdTimeout = int(properties.getProperty("SUnused_timeout"))
SagedTimeout = int(properties.getProperty("SAged_timeout"))
name = str(properties.getProperty("Name"))
jndiname = str(properties.getProperty("Jndi_Name"))
xa = str(properties.getProperty("XAEnabled"))
fail = str(properties.getProperty("Enable-return-methods-during-shutdown"))
auth_name = str(properties.getProperty("authMechanismPreference"))
msg = str(properties.getProperty("Msg-Retention"))
pool = str(properties.getProperty("Polling-Interval"))
qmanager = sys.argv[2]
rescan = str(properties.getProperty("Rescan-Interval"))
tptype = str(properties.getProperty("TransportType"))
connpool = str(properties.getProperty("useConnectionPooling"))
purge = str(properties.getProperty("Purge_policy"))
Spurge = str(properties.getProperty("SPurge_policy"))
mapping = str(properties.getProperty("Mapping-configuration-alias"))

QF(node,timeOut,maxConn,minConn,reapTime,unusdTimeout,agedTimeout,StimeOut,SmaxConn,SminConn,SreapTime,SunusdTimeout,SagedTimeout,name,jndiname,xa,fail,auth_name,msg,pool,qmanager,rescan,tptype,connpool,purge,Spurge,mapping)

Jython script to create queue destination at node scope

import sys,java
from java.util import Properties
from java.io import FileInputStream
from org.python.modules import time
lineSep = java.lang.System.getProperty('line.separator')

def QF(node,qmanager,jndiname,queue_name,target,name):

# Declare global variables

global AdminConfig
global AdminControl

# Gets the name of cell

cell = AdminControl.getCell()

cellid = AdminConfig.getid('/Cell:'+ cell +'/')

print " ----------------------------------------------------------------------------------------- "



#------QueueConnectionFactory--------#

MS=AdminConfig.getid('/Cell:'+ cell +'/Node:'+ node +'/JMSProvider:WebSphere MQ JMS Provider/')

QD=AdminConfig.getid('/Cell:'+ cell +'/Node:'+ node +'/JMSProvider:WebSphere MQ JMS Provider/MQQueue:'+ name +'/')

if len(QD) == 0 :
print "Queue does not exists .... "
else :
print "Queue exists, so removing old Queue ... "
AdminConfig.remove(QD)
print "Queue removed .. "


print "Creating Queue Destination .. "

name1 = ["name" , name]

jndi = ["jndiName" , jndiname ]

qm = ["baseQueueManagerName", qmanager ]

queue = ["baseQueueName", queue_name ]

target = ["targetClient", target ]

qd_attr = [name1 , jndi , qm , queue , target ]

newqf = AdminConfig.create('MQQueue' , MS , qd_attr)

print "Queue Destination created .. "

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- "




#--------------------------------------------------------------#


## Full Syncronization ##

print " Syncronizing configuration with Master Repository "

nodelist = AdminTask.listManagedNodes().split(lineSep)

for nodename in nodelist :

print " syncronizing nodes .......... "

####################Identifying the ConfigRepository MBean and assign it to variable######################

repo = AdminControl.completeObjectName('type=ConfigRepository,process=nodeagent,node='+ nodename +',*')

AdminControl.invoke(repo, 'refreshRepositoryEpoch')

sync = AdminControl.completeObjectName('cell='+ cell +',node='+ nodename +',type=NodeSync,*')

print AdminControl.invoke(sync , 'sync')

print " ----------------------------------------------------------------------------------------- "

print " ----------------------------------------------------------------------------------------- "

####################################################################################################################

#main program starts here

node = sys.argv[0]
target = sys.argv[1]
jndiname = sys.argv[2]
queue_name = sys.argv[3]
name=sys.argv[4]
qmanager = sys.argv[5]

QF(node,qmanager,jndiname,queue_name,target,name)