MDM Advanced Edition configuration script
Use the script in Example A-1 to achieve the required configuration in IBM InfoSphere Master Data Management (MDM) Advanced Edition for messaging integration.
Example A-1 MDM Advanced Edition configuration script for messaging integration
################################################################################
# Content of file MDMBPMSetupApp.py
################################################################################
import sys
################################################################################
#
# Functions:
#
# getPort
# createSIBAlias
# createForeignBus
# createForeignBusLink
# createSIBJMSQueue
# createSIBJMSConnectionFactory
# createDefaultJMSProvider
 
 
def getPort (portName, nodeName, serverName):
lineSeparator = java.lang.System.getProperty('line.separator')
node=AdminConfig.getid("/Node:"+nodeName+"/")
serverEntries = []
serverEntries=AdminConfig.list("ServerEntry",node).split(lineSeparator)
for serverEntry in serverEntries:
sName = AdminConfig.showAttribute(serverEntry,"serverName")
if sName == serverName:
specialEndPoints = []
temp = AdminConfig.showAttribute(serverEntry,"specialEndpoints")
specialEndPoints = AdminConfig.showAttribute(serverEntry,"specialEndpoints").split(" ")
for specialEndPoint in specialEndPoints:
specialEndPoint = specialEndPoint.replace("]","")
endPointNm = []
endPointNm = AdminConfig.showAttribute(specialEndPoint,"endPointName")
if endPointNm == portName:
ePoint = AdminConfig.showAttribute(specialEndPoint,"endPoint")
vhPort = AdminConfig.showAttribute(ePoint,"port")
#print " Get the Port - "+portName+" = "+vhPort
break
return vhPort
 
 
def createSIBAlias (clusterName,nodeName,serverName,SIBAliasName,SIBusName,targetBusName,targetDestinationName ):
#--------------------------------------------------------------------
# up globals
#--------------------------------------------------------------------
global AdminConfig
global AdminTask
#--------------------------------------------------------------------
# Create SIB queue
#--------------------------------------------------------------------
print ""
print "---------------------------------------------------------------"
print " Create SIB Alias "
print "---------------------------------------------------------------"
print " SIB Alias: "
print " name "+SIBAliasName+" "
print " SI bus: "
print " name "+SIBusName+" "
print "---------------------------------------------------------------"
print ""
#lineSeparator = java.lang.System.getProperty('line.separator')
#arr=AdminConfig.list("SIBAlias").split(lineSeparator)
#for queue in arr :
# identifier = AdminConfig.showAttribute(queue,"identifier")
# if identifier == SIBAliasName:
# print " The "+SIBAliasName+" SIB queue already exists"
# return
 
#--------------------------------------------------------------------
# Create SIB queue
#--------------------------------------------------------------------
print " Creating a new SIB Alias named "+SIBAliasName+"..."
if clusterName != "None":
params="[-bus "+SIBusName+" -name "+SIBAliasName+" -type Alias -cluster "+clusterName+" -targetBus "+targetBusName+" -targetName "+targetDestinationName+"]"
else:
params="[-bus "+SIBusName+" -name "+SIBAliasName+" -type Alias -node "+nodeName+" -server "+serverName+" -targetBus "+targetBusName+" -targetName "+targetDestinationName+"]"
try:
AdminTask.createSIBDestination(params)
except:
print " The "+SIBAliasName+" SIB Alias already exists"
def createForeignBus (clusterName,nodeName,serverName,SIBusName,foreignBusName):
#--------------------------------------------------------------------
# up globals
#--------------------------------------------------------------------
global AdminConfig
global AdminTask
#--------------------------------------------------------------------
# Create Foreign Bus
#--------------------------------------------------------------------
print ""
print "---------------------------------------------------------------"
print " Create Foreign Bus "
print "---------------------------------------------------------------"
print " Foreign Bus: "
print " name "+foreignBusName+" "
print " SI bus: "
print " name "+SIBusName+" "
print "---------------------------------------------------------------"
print ""
#--------------------------------------------------------------------
# Create Foreign Bus
#--------------------------------------------------------------------
print " Creating a new Foreign Bus named "+foreignBusName+"..."
if clusterName != "None":
params="[-bus "+SIBusName+" -name "+foreignBusName+" -routingType Direct -type SIBus ]"
else:
params="[-bus "+SIBusName+" -name "+foreignBusName+" -routingType Direct -type SIBus]"
try:
AdminTask.createSIBForeignBus(params)
except:
print " The "+foreignBusName+" foreign bus already exists"
 
def createForeignBusLink (clusterName,nodeName,serverName,SIBusName,foreignBusName,foreignBusMessagingEngineName,SIBLinkName,endpoint):
#--------------------------------------------------------------------
# up globals
#--------------------------------------------------------------------
global AdminConfig
global AdminTask
#--------------------------------------------------------------------
# Create Foreign Bus
#--------------------------------------------------------------------
print ""
print "---------------------------------------------------------------"
print " Create Foreign Bus "
print "---------------------------------------------------------------"
print " Foreign Bus: "
print " name "+foreignBusName+" "
print " SI bus: "
print " name "+SIBusName+" "
print "---------------------------------------------------------------"
print ""
#--------------------------------------------------------------------
# Create Foreign Bus
#--------------------------------------------------------------------
if clusterName != "None":
localMessagingEngine = clusterName+".000-"+SIBusName
else:
localMessagingEngine = nodeName+"."+serverName+"-"+SIBusName
print " Creating a new SIB Link named "+SIBLinkName+"..."
print " Foreign messaging engine name is "+foreignBusMessagingEngineName
 
params="[-bus "+SIBusName+" -messagingEngine "+localMessagingEngine+" -name "+SIBLinkName+" -foreignBusName "+foreignBusName+" -remoteMessagingEngineName "+foreignBusMessagingEngineName+" -bootstrapEndpoints "+endpoint+"]"
try:
AdminTask.createSIBLink(params)
except:
print " The "+SIBLinkName+" SIB Link already exists"
 
 
def createSIBJMSQueue (clusterName,nodeName,serverName,jmsQName,jmsQJNDI,jmsQDesc,SIBQName,SIBusName):
#--------------------------------------------------------------------
# up globals
#--------------------------------------------------------------------
global AdminConfig
global AdminTask
#--------------------------------------------------------------------
# Create SIB JMS queue
#--------------------------------------------------------------------
print ""
print "---------------------------------------------------------------"
print " Create SIB JMS queue "
print "---------------------------------------------------------------"
print " SIB "+SIBusName+" "
print " SIB JMS queue: "
print " name "+jmsQName+" "
print " JNDI "+jmsQJNDI+" "
print " description "+jmsQDesc+" "
print " SIB queue "+SIBQName+" "
print "---------------------------------------------------------------"
print ""
#--------------------------------------------------------------------
# Create SIB JMS queue that references a SIB queue
#--------------------------------------------------------------------
if clusterName != "None":
scope = AdminConfig.getid("/ServerCluster:"+clusterName+"/")
else:
scope = AdminConfig.getid("/Node:"+NodeName+"/Server:"+ServerName+"/")
#for queue in AdminTask.listSIBJMSQueues(scope):
# name = AdminConfig.showAttribute(queue,"name")
# if name == jmsQName:
# print " The "+jmsQName+" SIB JMS queue already exists"
# return
 
print " Creating a new SIB JMS queue named "+jmsQName+"..."
params = "[-busName "+SIBusName+" -name ""+jmsQName+"" -jndiName "+jmsQJNDI+" -description ""+jmsQDesc+"" -queueName "+SIBQName+"]"
try:
AdminTask.createSIBJMSQueue(scope,params)
except:
print " The "+jmsQName+" SIB JMS queue already exists"
 
def createSIBJMSConnectionFactory (clusterName,nodeName,serverName,jmsCFName,jmsCFJNDI,jmsCFDesc,jmsCFType,authAlias,SIBusName,endpoint):
#--------------------------------------------------------------------
# up globals
#--------------------------------------------------------------------
global AdminConfig
global AdminTask
#--------------------------------------------------------------------
# Create SIB JMS connection factory
#--------------------------------------------------------------------
print ""
print "---------------------------------------------------------------"
print " Create SIB JMS connection factory "
print "---------------------------------------------------------------"
print " Connection factory: "
print " name "+jmsCFName+" "
print " JNDI "+jmsCFJNDI+" "
print " description "+jmsCFDesc+" "
print " type "+jmsCFType+" "
print " auth alias "+authAlias+" "
print " SI bus: "
print " name "+SIBusName+" "
print "---------------------------------------------------------------"
print ""
if clusterName != "None":
jmsCF = AdminConfig.getid ("/ServerCluster:"+clusterName+"/J2CResourceAdapter:SIB JMS Resource Adapter/J2CConnectionFactory:"+jmsCFName)
else:
jmsCF = AdminConfig.getid ("/Node:"+nodeName+"/J2CResourceAdapter:SIB JMS Resource Adapter/J2CConnectionFactory:"+jmsCFName)
print ""
print " JMS Connection Factory ID is "+jmsCF
print ""
if len(jmsCF) != 0:
print " The "+jmsCFName+" JMS connection factory already exists"
return
#--------------------------------------------------------------------
# Create the SIB JMS connection factory
#--------------------------------------------------------------------
if clusterName != "None":
scope = AdminConfig.getid("/ServerCluster:"+clusterName+"/")
else:
scope = AdminConfig.getid("/Node:"+NodeName+"/Server:"+ServerName+"/")
print " Creating a new SIB JMS connection factory named "+jmsCFName+"..."
print scope
params = []
params.append(["-name",jmsCFName])
params.append(["-jndiName",jmsCFJNDI])
params.append(["-busName",SIBusName])
if jmsCFDesc != "":
arg = ["-description",jmsCFDesc]
params.append(arg);
endArg = ""
if endpoint != "":
endArg = " -providerEndPoints " + endpoint
if jmsCFType != "":
arg = ["-type",jmsCFType]
params = "[-name ""+jmsCFName+"" -jndiName "+jmsCFJNDI+" -type "+jmsCFType+" -busName "+SIBusName+ endArg+"]"
elif authAlias != "":
arg = ["-authDataAlias",authAlias]
params = "[-name ""+jmsCFName+"" -jndiName "+jmsCFJNDI+" -busName "+SIBusName+" -authDataAlias "+authAlias+ endArg+"]"
else:
params = "[-name ""+jmsCFName+"" -jndiName "+jmsCFJNDI+" -busName "+SIBusName+ endArg+"]"
print ""
AdminTask.createSIBJMSConnectionFactory(scope,params)
 
 
def createDefaultJMSProvider (clusterName,nodeName,serverName,SIBusName,targetBusName,targetDestinationName,targetMessagingEngineName,endPointPort):
print ""
print "Creating Default Messaging Provider"
print ""
print "Setting endpoint port"
endpoint = ""
if clusterName != "None":
clusterId = AdminConfig.getid("/ServerCluster:"+clusterName+"/")
 
lineSeparator = java.lang.System.getProperty('line.separator')
members = AdminConfig.list("ClusterMember",clusterId).split(lineSeparator)
 
for id in members:
srv = AdminConfig.showAttribute(id,"memberName")
node = AdminConfig.showAttribute(id,"nodeName")
nodeId = AdminConfig.getid("/Node:"+node+"/")
host = AdminConfig.showAttribute(nodeId,"hostName")
port = getPort("SIB_ENDPOINT_ADDRESS", node, srv)
endpoint1 = host+":"+port+":BootstrapBasicMessaging"
if endpoint == "":
endpoint = endpoint1
else:
endpoint = endpoint +","+endpoint1
else:
endpointPort = getPort("SIB_ENDPOINT_ADDRESS", nodeName, serverName)
print "endpoint port : "+endpointPort
if endpointPort != "7276":
endpoint = "localhost:" + endpointPort + ":BootstrapBasicMessaging"
jmsCFName = "MDMBPMQueueConnectionFactory"
jmsCFJNDI= "notification/MDMBPMQueueConnectionFactory"
jmsCFDesc= "MDM BPM Queue Connection Factory"
jmsCFType = "Queue"
secAuthAlias = ""
createSIBJMSConnectionFactory (clusterName,nodeName,serverName,jmsCFName,jmsCFJNDI,jmsCFDesc,jmsCFType,secAuthAlias,SIBusName,endpoint)
#--------------------------------------------------------------------
# Create JMS Queue
#--------------------------------------------------------------------
jmsQName= "MDMBPMQueue"
jmsQJNDI = "notification/MDMBPMQueue"
jmsQDesc= "MDM BPM Queue"
AliasQName = "MBMBPMAlias"
createSIBJMSQueue(clusterName,nodeName,serverName,jmsQName,jmsQJNDI,jmsQDesc ,AliasQName,SIBusName)
createSIBAlias(clusterName,nodeName,serverName,AliasQName ,SIBusName, targetBusName,targetDestinationName)
#-----------------------------------
# Create Foreign Bus
#----------------------------------
endpoint = "localhost:" + endPointPort + ":BootstrapBasicMessaging"
SIBLinkName="MDM_BPM_LINK"
createForeignBus (clusterName,nodeName,serverName,SIBusName,targetBusName)
createForeignBusLink (clusterName,nodeName,serverName,SIBusName,targetBusName,targetMessagingEngineName,SIBLinkName,endpoint)
 
################################################################################
# Prints the usage message
################################################################################
def printUsage ():
print ""
print "Usage:"
print ""
print " wsadmin -f MDMBPMSetupApp.py"
print " ClusterName"
print " NodeName"
print " ServerName"
print " SIBusName"
print " targetBusName"
print " targetDestinationName"
print " targetMessagingEngineName"
print " targetEndPointPort"
 
sys.exit(1)
 
 
################################################################################
# Main #
################################################################################
print "Number of arguments:"
print len(sys.argv)
if len(sys.argv) != 8:
printUsage()
sys.exit()
 
 
ClusterName = sys.argv[0];
NodeName = sys.argv[1];
ServerName = sys.argv[2];
SIBusName= sys.argv[3];
targetBusName = sys.argv[4];
targetDestinationName = sys.argv[5];
targetMessagingEngineName=sys.argv[6];
targetEndPointPort=sys.argv[7];
 
print ""
print "Setting up application server for MDM BPM Integration ..."
print " Cluster name : "+ClusterName
print " Node name : "+NodeName
print " Server name : "+ServerName
print " SI Bus name : "+SIBusName
print " Target Bus name : "+targetBusName
print " Target Destination Name : "+targetDestinationName
print " Target Messaging Engine Name : "+targetMessagingEngineName
print " Target End Point Port : "+targetEndPointPort
print ""
 
 
 
 
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#
# WAS or MQ JMS Queue Connection Factories #
#------------------------------------------------------------------------------#
 
createDefaultJMSProvider(ClusterName,NodeName,ServerName,SIBusName,targetBusName,targetDestinationName,targetMessagingEngineName,targetEndPointPort);
 
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#
# Save server configuration
#------------------------------------------------------------------------------#
print ""
if ClusterName != "None":
print " Saving configuration changes for cluster '"+ClusterName+"'...."
else:
print " Saving configuration changes for server '"+ServerName+"'..."
AdminConfig.save()
 
 
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#
# Done
#------------------------------------------------------------------------------#
print ""
print " Done setting up environment."
print ""
 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset