# check the domain else we need to skip this (done in wls_access.rb)
real_domain='<%= domain %>'



name                   = '<%= object_name %>'
jmsmodule              = '<%= jmsmodule %>'
foreign_server_name    = '<%= foreign_server_name %>'
object_type            = '<%= object_type %>'

edit()
startEdit()

try:

    cd('/')
    cd('/JMSSystemResources/'+jmsmodule+'/JMSResource/'+jmsmodule+'/ForeignServers/'+foreign_server_name)

    if object_type == "destination":

    if object_type == "connectionfactory":

    save()
    activate()          
    print "~~~~COMMAND SUCCESFULL~~~~"

except:
    print "Unexpected error:", sys.exc_info()[0]
    print "~~~~COMMAND FAILED~~~~"
    dumpStack()
    undo('true','y')
    stopEdit('y')
    raise




# check the domain else we need to skip this (done in wls_access.rb)
real_domain='<%= domain %>'



name                   = '<%= object_name %>'
jmsmodule              = '<%= jmsmodule %>'
foreign_server         = '<%= foreign_server %>'
object_type            = '<%= object_type %>'

edit()
startEdit()

try:

    cd('/')
    cd('/JMSSystemResources/'+jmsmodule+'/JMSResource/'+jmsmodule+'/ForeignServers/'+foreign_server)

    if object_type == "destination":
        remoteDestination = cmo.lookupForeignDestination(name)
        cmo.destroyForeignDestination(remoteDestination)

    if object_type == "connectionfactory":
        remoteConnectionFactory = cmo.lookupForeignConnectionFactory(name)
        cmo.destroyForeignConnectionFactory(remoteConnectionFactory)

    save()
    activate()          
    print "~~~~COMMAND SUCCESFULL~~~~"

except:
    print "Unexpected error:", sys.exc_info()[0]
    print "~~~~COMMAND FAILED~~~~"
    dumpStack()
    undo('true','y')
    stopEdit('y')
    raise




Implement destroying of foreign destinations/connection factories.
Implement destroying of foreign destinations/connection factories.
