All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nextflow.plugin.Plugins.groovy Maven / Gradle / Ivy

Go to download

A DSL modelled around the UNIX pipe concept, that simplifies writing parallel and scalable pipelines in a portable manner

The newest version!
/*
 * Copyright 2013-2024, Seqera Labs
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package nextflow.plugin

import java.nio.file.Path

import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.pf4j.PluginManager
/**
 * Plugin manager specialized for Nextflow build environment
 *
 * @author Paolo Di Tommaso 
 */
@Slf4j
@CompileStatic
class Plugins {

    public static final String DEFAULT_PLUGINS_REPO = 'https://raw.githubusercontent.com/nextflow-io/plugins/main/plugins.json'

    private final static PluginsFacade INSTANCE = new PluginsFacade()

    static PluginManager getManager() { INSTANCE.manager }

    static synchronized void init(boolean embeddedMode=false) {
        INSTANCE.init(embeddedMode)
    }

    static synchronized void init(Path root, String mode, CustomPluginManager pluginManager) {
        INSTANCE.init(root, mode, pluginManager)
    }

    /**
     * @param config
     */
    static void load(Map config) {
        INSTANCE.load(config)
    }

    static void start(String pluginId) {
        INSTANCE.start(pluginId)
    }

    static synchronized void stop() {
        INSTANCE.stop()
    }

    static  List getExtensions(Class type) {
        INSTANCE.getExtensions(type)
    }

    static  List getPriorityExtensions(Class type, String group=null) {
        INSTANCE.getPriorityExtensions(type,group)
    }

    static  T getExtension(Class type) {
        final allExtensions = INSTANCE.getExtensions(type)
        return allExtensions ? allExtensions.first() : null
    }

    static  List getExtensionsInPluginId(Class type, String pluginId) {
        final allExtensions = INSTANCE.getExtensions(type, pluginId)
        return allExtensions
    }

    static void pull(List ids) {
        INSTANCE.pullPlugins(ids)
    }

    static boolean startIfMissing(String pluginId) {
        if( INSTANCE ) {
            return INSTANCE.startIfMissing(pluginId)
        } else {
            log.debug "Plugins subsystem not available - Ignoring installIfMissing('$pluginId')"
            return false
        }
    }

    static boolean isStarted(String pluginId) {
        INSTANCE.isStarted(pluginId)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy