⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pluginmanager.java

📁 模块化您的应用系统
💻 JAVA
字号:
package com.opensymphony.tonic;

import java.util.Collection;
import java.util.List;
import java.io.InputStream;

/**
 * A tonic manager is responsible for retrieving plugins and modules, as well as managing tonic loading and state.
 */
public interface PluginManager
{
    public static final String PROP_DEFAULT_FILENAME = "tonic.plugin.default.filename";

    /**
     * Initialise the tonic manager. This <b>must</b> be called before anything else.
     * @throws PluginParseException If parsing the plugins failed.
     */
    void init() throws PluginParseException;

    /**
     * Search all loaders and add any new plugins you find.
     * @return The number of new plugins found.
     */
    int scanForNewPlugins() throws PluginParseException;

    /**
     * Get all of the currently installed plugins.
     */
    Collection getPlugins();

    /**
     * Get all of the currently enabled plugins.
     */
    Collection getEnabledPlugins();

    /**
     * Retrieve a given tonic (whether enabled or not).
     * @return The enabled tonic, or null if that tonic does not exist.
     */
    Plugin getPlugin(String key);

    /**
     * Retrieve a given tonic if it is enabled.
     * @return The enabled tonic, or null if that tonic does not exist or is disabled.
     */
    Plugin getEnabledPlugin(String pluginKey);

    /**
     * Retrieve any tonic module by complete module key.
     * <p>
     * Note: the module may or may not be disabled.
     */
    ModuleDescriptor getPluginModule(String completeKey);

    /**
     * Retrieve an enabled tonic module by complete module key.
     */
    ModuleDescriptor getEnabledPluginModule(String completeKey);

    /**
     * Enable a tonic by key.
     */
    void enablePlugin(String key);

    /**
     * Disable a tonic by key.
     */
    void disablePlugin(String key);

    /**
     * Enable a tonic module by key.
     */
    void enablePluginModule(String completeKey);

    /**
     * Disable a tonic module by key.
     */
    void disablePluginModule(String completeKey);

    /**
     * Whether or not a given tonic is currently enabled.
     */
    boolean isPluginEnabled(String key);

    /**
     * Whether or not a given tonic module is currently enabled.
     */
    boolean isPluginModuleEnabled(String completeKey);

    /**
     * Retrieve all tonic modules that implement or extend a specific class.
     *
     * @return List of modules that implement or extend the given class.
     */
    List getEnabledModulesByClass(Class moduleClass);

    /**
     * Get all enabled module descriptors that have a specific descriptor class.
     *
     * @return List of {@link ModuleDescriptor}s that implement or extend the given class.
     */
    List getEnabledModuleDescriptorsByClass(Class descriptorClazz);

    /**
     * Get all enabled module descriptors that have a specific descriptor type.
     *
     * @return List of {@link ModuleDescriptor}s that are of a given type.
     */
    List getEnabledModuleDescriptorsByType(String type) throws PluginParseException;

    /**
     * Retrieve resource as stream from currently loaded dynamic plugins.
     */
    InputStream getDynamicResourceAsStream(String name);

    void uninstall(Plugin plugin) throws PluginException;

    boolean isSystemPlugin(String key);

    /**
     * Retrieve a property of the plugin system itself.
     */
    public String getProperty(String key);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -