• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PluginManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.xeoh.plugins.base.PluginManager的典型用法代码示例。如果您正苦于以下问题:Java PluginManager类的具体用法?Java PluginManager怎么用?Java PluginManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PluginManager类属于net.xeoh.plugins.base包,在下文中一共展示了PluginManager类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPlugins

import net.xeoh.plugins.base.PluginManager; //导入依赖的package包/类
private List<P> getPlugins(String[] pluginFolders) {
    PluginManager pm = PluginManagerFactory.createPluginManager();
    pm.addPluginsFrom(ClassURI.CLASSPATH, new OptionReportAfter());
    Arrays.asList(pluginFolders).stream().forEach(folder -> {
        pm.addPluginsFrom(new File(folder).toURI(), new OptionReportAfter());
    });
    PluginManagerUtil pmu= new PluginManagerUtil(pm);
    return pmu.getPlugins(Plugin.class).stream().filter(selector).map(p->(P)p).collect(Collectors.toList());
}
 
开发者ID:AI-12,项目名称:A-Fucking-AI,代码行数:10,代码来源:CompetitionGUI.java


示例2: thisPlugin

import net.xeoh.plugins.base.PluginManager; //导入依赖的package包/类
/**
 * Allows you to get the plugin you want if it's installed. Advise : put it in the dependencies
 *
 * @param plugin_name String The name of the wanted plugin
 * @return Corpoplugins The plugin with the given name
 */
public static Corpoplugins thisPlugin(String plugin_name) {
    // Setting up the PluginManager from jspf
    PluginManager pm = PluginManagerFactory.createPluginManager();
    try {
        configString = getConfig();
        if (Install.isInstalled(plugin_name))
            pm.addPluginsFrom(new File(PLUGINDIRECTORY + plugin_name.toLowerCase() + System.getProperty("file.separator")).toURI());
        return pm.getPlugin(Corpoplugins.class);
    } catch (IOException e) {
        System.err.println(e.getMessage());
    }
    return null;
}
 
开发者ID:Corporatique-dev,项目名称:Corporatique,代码行数:20,代码来源:Execute.java


示例3: loadPlugins

import net.xeoh.plugins.base.PluginManager; //导入依赖的package包/类
@Override
public <T extends Plugin> List<T> loadPlugins(Class<T> cls) {
	// register plugins from plugins directory
	PluginManager pm = PluginManagerFactory.createPluginManager();
	pm.addPluginsFrom(new File("." + File.separator + "plugins").toURI());
	PluginManagerUtil pmu = new PluginManagerUtil(pm);	
	ArrayList<T> ret = new ArrayList<T>();
	Collection<T> plugins = pmu.getPlugins(cls);
	if(plugins!=null){
		ret.addAll(plugins);
	}
	return ret;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:14,代码来源:ODLApiImpl.java


示例4: registerPluginDirectory

import net.xeoh.plugins.base.PluginManager; //导入依赖的package包/类
public static PluginManagerUtil registerPluginDirectory(File dir) {
	PluginManager pm = PluginManagerFactory.createPluginManager();
	pm.addPluginsFrom(dir.toURI());
	PluginManagerUtil pmu = new PluginManagerUtil(pm);		
	for(ODLComponent component : pmu.getPlugins(ODLComponent.class)){
		logger.info("Found component " + component.getId() + " in directory " + dir.getAbsolutePath());
		register(component);
	}
	return pmu;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:11,代码来源:ODLGlobalComponents.java


示例5: updatePlugin

import net.xeoh.plugins.base.PluginManager; //导入依赖的package包/类
/**
 * Will update the given plugin. Will check if the plugin is already installed, compare its version,
 * if its dependencies are present (will execute a dry run of install for it).
 * And then use Delete and Install to reinstall the plugin.
 *
 * @param path_to_update String The plugin which will be updated.
 * @param debug          boolean Will display the progression of the action if true.
 * @see core.Install
 * @see Delete
 */
public static void updatePlugin(String path_to_update, boolean debug) {
    File plugin_path = new File(path_to_update);

    try {
        if (!plugin_path.exists() || !plugin_path.isFile())
            throw new IsNotFileException(path_to_update);

        // Setting up the PluginManger from jspf
        PluginManager pm = PluginManagerFactory.createPluginManager();
        // adding the path to verify
        pm.addPluginsFrom(plugin_path.toURI());
        // getting the class which implements our plugin interface
        Corpoplugins extension = pm.getPlugin(Corpoplugins.class);
        Pluginspecs new_plugin_specs;

        configString = ActionBase.getConfig(); // Get the configuration file
        new_plugin_specs = extension.getClass()
                .getAnnotation(Pluginspecs.class); // Get the Pluginspecs from jar

        if (debug) System.out.print(Flags.getString("install.plugin-specs")
                + extension.getClass());
        if (new_plugin_specs == null)
            throw new PluginSpecsNotFoundException(extension.getClass()
                    .toString()); // if there is no annotations
        if (debug) {
            System.out.println(Flags.getString("done"));
            System.out.print(Flags.getString("update.verification"));
        }
        if (!Install.isInstalled(new_plugin_specs.name()))
            throw new PluginNotFoundException(new_plugin_specs.name()); // if the plugin is NOT installed
        if (debug) {
            System.out.println(Flags.getString("done"));
            System.out.print(Flags.getString("install.dependencies"));
        }
        Install.hasDependencies(new_plugin_specs); // if all the dependencies are present
        if (debug) {
            System.out.println(Flags.getString("done"));
            System.out.print(Flags.getString("update.version"));
        }
        if (!compareVersion(new_plugin_specs))//if the plugin installed is newer
            throw new PluginIsNewer(new_plugin_specs.name());
        if (debug) {
            System.out.println(Flags.getString("done"));
        }
        Delete.deletePlugin(new_plugin_specs.name(), debug);
        Install.installPlugin(path_to_update, debug);

    } catch (IOException | PluginNotFoundException | PluginSpecsNotFoundException |
            PluginDependenciesNotPresentException | IsNotFileException | PluginIsNewer e) {
        System.err.println(e.getMessage());
    }
}
 
开发者ID:Corporatique-dev,项目名称:Corporatique,代码行数:63,代码来源:Update.java


示例6: pluginDetails

import net.xeoh.plugins.base.PluginManager; //导入依赖的package包/类
/**
     * Gives the specifications of the given plugin, used in --help
     *
     * @param plugin_name String the name of the plugin.
     * @param debug       true to display debug information
     * @return The plugin specifications.
     */
    public static String pluginDetails(String plugin_name, boolean debug) {

        String plugin = EMPTYSTRING;
        // Setting up the PluginManger from jspf
        PluginManager pm = PluginManagerFactory.createPluginManager();
// adding the path to verify
        pm.addPluginsFrom(new File(PLUGINDIRECTORY + plugin_name.toLowerCase() + System.getProperty("file.separator")).toURI());
// getting the class which implements our plugin interface
        Corpoplugins extension = pm.getPlugin(Corpoplugins.class);

        try {
            configString = getConfig();
            Delete.findPluginLine(plugin_name);

            if (debug) System.out.print(Flags.getString("install.plugin-specs")
                    + extension.getClass());
            Pluginspecs plugin_specs = extension.getClass()
                    .getAnnotation(Pluginspecs.class);
            if (plugin_specs == null)
                throw new PluginSpecsNotFoundException(extension.getClass()
                        .toString()); // if there is no annotations
            if (debug) System.out.println(Flags.getString("done"));

            plugin += "Plugin name: " + plugin_specs.name() + System.lineSeparator();
            plugin += "Description: " + plugin_specs.description() + System.lineSeparator();
            plugin += "Version: " + plugin_specs.version() + System.lineSeparator();
            plugin += "Author: " + plugin_specs.author() + System.lineSeparator();
            plugin += "Supported formats: ";
            for (String format : plugin_specs.extensions()) {
                plugin += " ." + format;
            }
            plugin += System.lineSeparator() + "Dependencies: ";
            for (String dependency : plugin_specs.dependencies()) {
                plugin += dependency + ", ";
            }

        } catch (PluginSpecsNotFoundException | IOException | PluginNotFoundException e) {
            System.err.println(e.getMessage());
        }
        return plugin;
    }
 
开发者ID:Corporatique-dev,项目名称:Corporatique,代码行数:49,代码来源:OtherActions.java


示例7: installPlugin

import net.xeoh.plugins.base.PluginManager; //导入依赖的package包/类
/**
     * Will install the specified plugin. Will if the plugin is extended from the Corpoplugin interface,
     * check if it's aready installed, then will copy it under : installation_folder/plugin_name/
     *
     * @param path_to_install String Is the path to the plugin to install
     * @param debug           boolean Will display the progression of the action if true.
     * @see Delete
     */
    public static void installPlugin(String path_to_install, boolean debug) {
        File plugin_path = new File(path_to_install);

        try {
            if (!plugin_path.exists() || !plugin_path.isFile())
                throw new IsNotFileException((path_to_install));

            // Setting up the PluginManger from jspf
            PluginManager pm = PluginManagerFactory.createPluginManager();
// adding the path to verify
            pm.addPluginsFrom(plugin_path.toURI());
// getting the class which implements our plugin interface
            Corpoplugins extension = pm.getPlugin(Corpoplugins.class);
            Pluginspecs plugin_specs;

            configString = ActionBase.getConfig(); // Get the configuration file
            plugin_specs = extension.getClass()
                    .getAnnotation(Pluginspecs.class); // Get the Pluginspecs from jar

            if (debug) System.out.print(Flags.getString("install.plugin-specs")
                    + extension.getClass());
            if (plugin_specs == null)
                throw new PluginSpecsNotFoundException(extension.getClass()
                        .toString()); // if there is no annotations
            if (debug) System.out.println(Flags.getString("done"));

            if (debug) System.out.print(Flags.getString("install.verification"));
            if (isInstalled(plugin_specs.name()))
                throw new PluginIsInstalledException(plugin_specs.name()); // if the plugin is already installed
            if (debug) System.out.println(Flags.getString("done"));

            if (debug) System.out.print(Flags.getString("install.dependencies"));
            hasDependencies(plugin_specs); // if all the dependencies are present
            if (debug) System.out.println(Flags.getString("done"));

            if (debug) System.out.print(Flags.getString("install.copyjar")
                    + plugin_specs.name().toLowerCase()
                    + Flags.getString("install.copyjar2"));
            copyPlugintoDirectory(plugin_specs.name(), plugin_path);
            if (debug) System.out.println(Flags.getString("done"));

            if (debug) System.out.print(Flags.getString("install.adding-properties"));
            addPlugintoConfig(plugin_specs);
            if (debug) System.out.println(Flags.getString("done"));

            System.out.println(Flags.getString("install.success"));
        } catch (IOException | PluginDependenciesNotPresentException | PluginIsInstalledException
                | PluginSpecsNotFoundException | IsNotJarException | IsNotFileException e) {
            System.err.println(e.getMessage());
        }
    }
 
开发者ID:Corporatique-dev,项目名称:Corporatique,代码行数:60,代码来源:Install.java



注:本文中的net.xeoh.plugins.base.PluginManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PackageBuilder类代码示例发布时间:2022-05-23
下一篇:
Java TransformerFactoryImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap