Package de.grogra.pm

Class PluginManager

All Implemented Interfaces:
RegistryContext, Disposable, ResourceConverter

public class PluginManager extends Plugin implements Disposable, ResourceConverter
  • Field Details

  • Constructor Details

    • PluginManager

      public PluginManager()
  • Method Details

    • getInstance

      public static PluginManager getInstance()
    • startup

      public void startup()
      Description copied from class: Plugin
      This method is invoked when the plugin is activated, i.e., when the first class defined by the plugin is loaded (except for the Plugin class itself). The default implementation executes all executable items in the directory /hooks/startup/name, where name is the name of the plugin.

      The method Plugin.initialize() has been invoked before. Only if this invocation has returned true, the plugin may be activated.

      Overrides:
      startup in class Plugin
    • canHandleConversion

      public boolean canHandleConversion(String name)
      Specified by:
      canHandleConversion in interface ResourceConverter
    • convert

      public Object convert(String name, String argument, I18NBundle bundle)
      Specified by:
      convert in interface ResourceConverter
    • initSources

      public void initSources()
    • hasPlugins

      public boolean hasPlugins()
    • load

      public void load() throws Throwable
      Throws:
      Throwable
    • addMissingVersions

      public void addMissingVersions(PluginEntry pluginFromJSON)
    • containsPlugin

      public Boolean containsPlugin(String id)
    • startModifications

      public void startModifications(Set<PluginEntry> delPlugins, Set<PluginEntry> installPlugins, Set<PluginEntry> disablePlugins, Set<PluginEntry> ablePlugins, boolean doRestart, LinkedList<String> additionalGroIMPptions) throws IOException
      Throws:
      IOException
    • applyChanges

      public void applyChanges(GenericCallback<String> statusChanged, boolean doRestart, LinkedList<String> additionalGroIMPoptions)
    • getChangesAsText

      public String getChangesAsText()
    • getChangesAsText

      public String getChangesAsText(DependencyResolver resolver)
    • getChangesAsText

      public String getChangesAsText(boolean reload)
    • loadPluginFromLocalRepo

      public void loadPluginFromLocalRepo(File path)
    • loadPluginFromRemoteRepo

      public void loadPluginFromRemoteRepo(org.json.JSONArray json)
    • loadPluginFromRepo

      public void loadPluginFromRepo(org.json.JSONArray json)
      Load the plugins from the json array to the set of allPlugins
      Parameters:
      json -
    • getPluginFromRemoteRepo

      public Set<PluginEntry> getPluginFromRemoteRepo(org.json.JSONArray json)
      Get the plugin entries from a json array
      Parameters:
      json -
    • getPluginFromRepo

      public Set<PluginEntry> getPluginFromRepo(org.json.JSONArray json)
    • getAlreadyInstalledPlugins

      public HashMap<PluginEntry,Integer> getAlreadyInstalledPlugins()
    • scanPluginsDirectory

      public HashMap<PluginEntry,Integer> scanPluginsDirectory(Node dir)
    • getInstalledPlugins

      public Set<PluginEntry> getInstalledPlugins()
    • getInstalledPlugins

      public static Set<PluginEntry> getInstalledPlugins(Map<PluginEntry,Integer> allPlugins)
    • getAvailablePlugins

      public Set<PluginEntry> getAvailablePlugins()
    • getUpgradablePlugins

      public Set<PluginEntry> getUpgradablePlugins()
    • togglePlugins

      public void togglePlugins(Set<PluginEntry> pluginsToInstall, int isInstall)
    • toggleInstalled

      public void toggleInstalled(PluginEntry plugin, int peState)
      Change the state of a plugin. States are checked when the modifications are resolved. The states are INSTALL, UNINSTALL, DISABLE.
      Parameters:
      plugin -
      peState -
    • hasAnyUpdates

      public boolean hasAnyUpdates()
    • getPluginByID

      public PluginEntry getPluginByID(String key)
    • getPluginByName

      public PluginEntry getPluginByName(String key)
    • setTimeout

      public void setTimeout(int timeout)
    • getPluginStatus

      public static String getPluginStatus(String id)
      Parameters:
      id - ID of the plugin to check
      Returns:
      Version name for the plugin if it is installed, null otherwise
    • getAllPluginsStatus

      public static String getAllPluginsStatus()
      Returns:
      Status for all plugins
    • getAllPlugins

      public Map<PluginEntry,Integer> getAllPlugins()
    • getAvailablePluginsAsString

      public static String getAvailablePluginsAsString()
      Returns:
      Available plugins
    • getUpgradablePluginsAsString

      public static String getUpgradablePluginsAsString()
      Returns:
      Upgradable plugins
    • logPluginComponents

      public void logPluginComponents()
    • changeCallBack

      public void changeCallBack(GenericCallback<Object> newCallBack)
    • dispose

      public void dispose()
      Specified by:
      dispose in interface Disposable
    • clearCache

      public void clearCache() throws IOException
      Throws:
      IOException
    • reloadRepo

      public void reloadRepo() throws Throwable
      Throws:
      Throwable
    • clearRepo

      public void clearRepo() throws Throwable
      Throws:
      Throwable
    • getMainRepo

      public List<String> getMainRepo()
    • exportPluginList

      public void exportPluginList(File output, GenericCallback<Object> statusChange)
    • exportPluginList

      public static void exportPluginList(Item item, Object info, Context ctx)
    • importPluginList

      public void importPluginList(File input, GenericCallback<Object> statusChanged)
      This set the plugin entries to match the set of plugin from the file input. I.e. it deactivate plugins that are not in the list, and
      Parameters:
      input -
    • importPluginList

      public void importPluginList(GenericCallback<Object> statusChanged, Context ctx)
    • importPluginList

      public static void importPluginList(Item item, Object info, Context ctx)
    • clearCache

      public static void clearCache(Item item, Object info, Context ctx)
    • reloadRepositories

      public static void reloadRepositories(Item item, Object info, Context ctx)
    • getRepoManager

      public de.grogra.pm.repo.RepoManager getRepoManager()
    • createPluginPanel

      public static Panel createPluginPanel(Context ctx, Map params)
    • describeAllPlugins

      public static void describeAllPlugins(Item item, Object info, Context ctx)
    • describePlugin

      public static void describePlugin(Item item, Object info, Context ctx)
    • selectVersion

      public static void selectVersion(Item item, Object info, Context ctx)
    • applyChanges

      public static void applyChanges(Item item, Object info, Context ctx)
    • setAllUpgrade

      public static void setAllUpgrade(Item item, Object info, Context ctx)