Example #1
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    old_module = pipeline.modules[module_id]
    # first check package
    # v1.0 types:
    if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
        wsdl = old_module.namespace.split('|')[0]
        namespace = old_module.namespace.split('|')[1]
    else:
        wsdl = toAddress(old_module.package)
        namespace = old_module.namespace
    name = old_module.name

    wsdlList = []
    if configuration.check('wsdlList'):
        wsdlList = configuration.wsdlList.split(";")
    if not wsdl in wsdlList:
        service = Service(wsdl)
        if not service.service:
            return []
        webServicesDict[wsdl] = service
        wsdlList.append(wsdl)
        configuration.wsdlList = ';'.join(wsdlList)

    if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
        reg = vistrails.core.modules.module_registry.get_module_registry()
        new_descriptor = reg.get_descriptor_by_name(toSignature(wsdl), name,
                                                    namespace)
        if not new_descriptor:
            return []
        return UpgradeWorkflowHandler.replace_module(controller, pipeline,
                                                module_id, new_descriptor)

    return UpgradeWorkflowHandler.attempt_automatic_upgrade(controller, 
                                                            pipeline,
                                                            module_id)
Example #2
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    old_module = pipeline.modules[module_id]
    # first check package
    # v1.0 types:
    if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
        wsdl = old_module.namespace.split('|')[0]
        namespace = old_module.namespace.split('|')[1]
    else:
        wsdl = toAddress(old_module.package)
        namespace = old_module.namespace
    name = old_module.name

    wsdlList = []
    if configuration.check('wsdlList'):
        wsdlList = configuration.wsdlList.split(";")
    if not wsdl in wsdlList:
        service = Service(wsdl)
        if not service.service:
            return []
        webServicesDict[wsdl] = service
        wsdlList.append(wsdl)
        configuration.wsdlList = ';'.join(wsdlList)

    if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
        reg = vistrails.core.modules.module_registry.get_module_registry()
        new_descriptor = reg.get_descriptor_by_name(toSignature(wsdl), name,
                                                    namespace)
        if not new_descriptor:
            return []
        return UpgradeWorkflowHandler.replace_module(controller, pipeline,
                                                     module_id, new_descriptor)

    return UpgradeWorkflowHandler.attempt_automatic_upgrade(
        controller, pipeline, module_id)
Example #3
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    # Before 0.0.3, SQLSource's resultSet output was type ListOfElements (which
    #   doesn't exist anymore)
    # In 0.0.3, SQLSource's resultSet output was type List
    # In 0.1.0, SQLSource's output was renamed to result and is now a Table;
    #   this is totally incompatible and no upgrade code is possible
    #   the resultSet is kept for now for compatibility

    # Up to 0.0.4, DBConnection would ask for a password if one was necessary;
    #   this behavior has not been kept. There is now a password input port, to
    #   which you can connect a PasswordDialog from package dialogs if needed

    old_module = pipeline.modules[module_id]
    # DBConnection module from before 0.1.0: automatically add the password
    # prompt module
    if (old_module.name == 'DBConnection'
            and versions_increasing(old_module.version, '0.1.0')):
        reg = get_module_registry()
        # Creates the new module
        new_module = controller.create_module_from_descriptor(
            reg.get_descriptor(DBConnection))
        # Create the password module
        mod_desc = reg.get_descriptor_by_name(
            'org.vistrails.vistrails.dialogs', 'PasswordDialog')
        mod = controller.create_module_from_descriptor(mod_desc)
        # Adds a 'label' function to the password module
        ops = [('add', mod)]
        ops.extend(
            controller.update_function_ops(mod, 'label', ['Server password']))
        # Connects the password module to the new module
        conn = controller.create_connection(mod, 'result', new_module,
                                            'password')
        ops.append(('add', conn))
        # Replaces the old module with the new one
        upgrade_actions = UpgradeWorkflowHandler.replace_generic(
            controller,
            pipeline,
            old_module,
            new_module,
            src_port_remap={'self': 'connection'})
        password_fix_action = create_action(ops)
        return upgrade_actions + [password_fix_action]

    return UpgradeWorkflowHandler.attempt_automatic_upgrade(
        controller, pipeline, module_id)
Example #4
0
def handle_module_upgrade_request(controller, module_id, pipeline):
    # Before 0.0.3, SQLSource's resultSet output was type ListOfElements (which
    #   doesn't exist anymore)
    # In 0.0.3, SQLSource's resultSet output was type List
    # In 0.1.0, SQLSource's output was renamed to result and is now a Table;
    #   this is totally incompatible and no upgrade code is possible
    #   the resultSet is kept for now for compatibility

    # Up to 0.0.4, DBConnection would ask for a password if one was necessary;
    #   this behavior has not been kept. There is now a password input port, to
    #   which you can connect a PasswordDialog from package dialogs if needed

    old_module = pipeline.modules[module_id]
    # DBConnection module from before 0.1.0: automatically add the password
    # prompt module
    if (old_module.name == 'DBConnection' and
            versions_increasing(old_module.version, '0.1.0')):
        reg = get_module_registry()
        # Creates the new module
        new_module = controller.create_module_from_descriptor(
                reg.get_descriptor(DBConnection))
        # Create the password module
        mod_desc = reg.get_descriptor_by_name(
                'org.vistrails.vistrails.dialogs', 'PasswordDialog')
        mod = controller.create_module_from_descriptor(mod_desc)
        # Adds a 'label' function to the password module
        ops = [('add', mod)]
        ops.extend(controller.update_function_ops(mod,
                                                  'label', ['Server password']))
        # Connects the password module to the new module
        conn = controller.create_connection(mod, 'result',
                                            new_module, 'password')
        ops.append(('add', conn))
        # Replaces the old module with the new one
        upgrade_actions = UpgradeWorkflowHandler.replace_generic(
                controller, pipeline,
                old_module, new_module,
                src_port_remap={'self': 'connection'})
        password_fix_action = create_action(ops)
        return upgrade_actions + [password_fix_action]

    return UpgradeWorkflowHandler.attempt_automatic_upgrade(
            controller, pipeline,
            module_id)
Example #5
0
    if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
        reg = vistrails.core.modules.module_registry.get_module_registry()
        new_descriptor = reg.get_descriptor_by_name(toSignature(wsdl), name,
                                                    namespace)
        if not new_descriptor:
            return []
        try:
            return UpgradeWorkflowHandler.replace_module(controller, pipeline,
                                                    module_id, new_descriptor)
        except Exception, e:
            import traceback
            traceback.print_exc()
            raise

    return UpgradeWorkflowHandler.attempt_automatic_upgrade(controller, 
                                                            pipeline,
                                                            module_id)

def handle_missing_module(controller, module_id, pipeline):
    global webServicesDict
    global package_cache

    def get_wsdl_from_namespace(m_namespace):
        try:
            wsdl = m_namespace.split("|")
            return wsdl[0]
        except:
            return None
    
    m = pipeline.modules[module_id]
    if m.package == identifier:
Example #6
0
    if old_module.package == 'edu.utah.sci.vistrails.sudswebservices':
        reg = vistrails.core.modules.module_registry.get_module_registry()
        new_descriptor = reg.get_descriptor_by_name(toSignature(wsdl), name,
                                                    namespace)
        if not new_descriptor:
            return []
        try:
            return UpgradeWorkflowHandler.replace_module(
                controller, pipeline, module_id, new_descriptor)
        except Exception, e:
            import traceback
            traceback.print_exc()
            raise

    return UpgradeWorkflowHandler.attempt_automatic_upgrade(
        controller, pipeline, module_id)


def handle_missing_module(controller, module_id, pipeline):
    global webServicesDict
    global package_cache

    def get_wsdl_from_namespace(m_namespace):
        try:
            wsdl = m_namespace.split("|")
            return wsdl[0]
        except Exception, e:
            debug.unexpected_exception(e)
            return None

    m = pipeline.modules[module_id]