-
Notifications
You must be signed in to change notification settings - Fork 1
/
uninstall-syco-resources.py
107 lines (88 loc) · 3.46 KB
/
uninstall-syco-resources.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# environment-specific variables
nodeName="CARS-GHEIDORNNode01"
serverName="server1"
busName = "syco.bus"
def deleteCF(jmsCFName):
#--------------------------------------------------------------------
# Retrieve specific Object ID and remove Connection Factory using ID
#--------------------------------------------------------------------
jmsCF = AdminConfig.getid('/Server:%s/J2CResourceAdapter:SIB JMS Resource Adapter/J2CConnectionFactory:%s' % (serverName,jmsCFName))
if(jmsCF != ""):
AdminConfig.remove(jmsCF)
print " deleted connection factory %s" % jmsCFName
else:
print " connection factory %s not found" % jmsCFName
#endElse
#endDef
def deleteQueue(qName):
#--------------------------------------------------------------------
# Search for queue based on scope and delete
#--------------------------------------------------------------------
for queue in AdminTask.listSIBJMSQueues(scope).splitlines():
name = AdminConfig.showAttribute(queue, "name")
if (name == qName):
AdminTask.deleteSIBJMSQueue(queue)
print " deleted queue %s" % qName
return
#endIf
#endFor
print " queue %s not found" % qName
#endDef
def deleteAS(jmsASName):
#--------------------------------------------------------------------
# Retrieve specific Resource Adapter Type ID for SIB JMS Resource Adapter
#--------------------------------------------------------------------
ra = AdminConfig.getid('/Server:%s/J2CResourceAdapter:SIB JMS Resource Adapter' % serverName)
#--------------------------------------------------------------------
# Remove the Activation Spec found in the SIB JMS Resource Adapter
#--------------------------------------------------------------------
for spec in AdminTask.listJ2CActivationSpecs(ra, ["-messageListenerType", "javax.jms.MessageListener"]).splitlines():
name = AdminConfig.showAttribute(spec, "name")
if (name == jmsASName):
AdminConfig.remove(spec)
print " deleted activation spec %s" % jmsASName
return
#endIf
#endFor
print " activation spec %s not found" % jmsASName
#endDef
def deleteBus(busName):
for bus in AdminTask.listSIBuses().splitlines():
name = AdminConfig.showAttribute(bus, "name")
if (name == busName):
params = ["-bus", busName]
AdminTask.deleteSIBus(params)
print " deleted bus %s" % busName
return
#endIf
#endFor
print " bus %s not found" % busName
#enddef
#
# runtime
#
print ""
print "This script has the following targets defined:"
print "Node: %s" % nodeName
print "Server: %s" % serverName
print ""
scope = AdminConfig.getid('/Node:%s/Server:%s' % (nodeName, serverName))
prefixName = "SYCO"
eventQName = "%s_EventQ" % prefixName
submittedAdQName = "%s_SubmittedAdQ" % prefixName
cfName = "%s_CF" % prefixName
print "Deleting queue %s..." % eventQName
deleteQueue(eventQName)
print "Deleting queue %s..." % submittedAdQName
deleteQueue(submittedAdQName)
print "Deleting connection factory %s..." % cfName
deleteCF(cfName)
#print "Deleting activation specification %s..." % activSpecName
#deleteAS(activSpecName)
print "Delete service integration bus %s" % busName
deleteBus(busName)
print "Saving..."
AdminConfig.save()
print ""
print "Resources deleted, configuration saved"
print "Please restart the application server to finalize changes"