def create_admin_object_resource(name, server=None, **kwargs):
    '''
    Create a JMS destination
    '''
    defaults = {
        'description': '',
        'className': 'com.sun.messaging.Queue',
        'enabled': True,
        'id': name,
        'resAdapter': 'jmsra',
        'resType': 'javax.jms.Queue',
        'target': 'server'
    }

    # Data = defaults + merge kwargs + poolname
    data = defaults
    data.update(kwargs)

    # ClassName isn't optional, even if the API says so
    if data['resType'] == 'javax.jms.Queue':
        data['className'] = 'com.sun.messaging.Queue'
    elif data['resType'] == 'javax.jms.Topic':
        data['className'] = 'com.sun.messaging.Topic'
    else:
        raise CommandExecutionError('resType should be "javax.jms.Queue" or "javax.jms.Topic"!')

    if data['resAdapter'] != 'jmsra':
        raise CommandExecutionError('resAdapter should be "jmsra"!')

    # Fix for lowercase vs camelCase naming differences
    if 'resType' in data:
        data['restype'] = data['resType']
        del data['resType']
    if 'className' in data:
        data['classname'] = data['className']
        del data['className']

    return _create_element(name, 'resources/admin-object-resource', data, server)
def create_admin_object_resource ( name , server = None , ** kwargs ) : defaults = { 'description' : '' , 'className' : 'com.sun.messaging.Queue' , 'enabled' : True , 'id' : name , 'resAdapter' : 'jmsra' , 'resType' : 'javax.jms.Queue' , 'target' : 'server' } data = defaults data . update ( kwargs ) if data [ 'resType' ] == 'javax.jms.Queue' : data [ 'className' ] = 'com.sun.messaging.Queue' elif data [ 'resType' ] == 'javax.jms.Topic' : data [ 'className' ] = 'com.sun.messaging.Topic' else : raise CommandExecutionError ( 'resType should be "javax.jms.Queue" or "javax.jms.Topic"!' ) if data [ 'resAdapter' ] != 'jmsra' : raise CommandExecutionError ( 'resAdapter should be "jmsra"!' ) if 'resType' in data : data [ 'restype' ] = data [ 'resType' ] del data [ 'resType' ] if 'className' in data : data [ 'classname' ] = data [ 'className' ] del data [ 'className' ] return _create_element ( name , 'resources/admin-object-resource' , data , server )
Create a JMS destination