Class PluginUtils

java.lang.Object
org.omegat.filters2.master.PluginUtils

public final class PluginUtils extends Object
Static utilities for OmegaT filter plugins.
  • Field Details

  • Method Details

    • loadPlugins

      public static void loadPlugins(Map<String,String> params)
      Loads plugins for the application. This method initializes plugin locations, class loaders, and processes plugin manifests to load plugins based on the provided parameters.
      Parameters:
      params - a map containing configuration parameters that may specify additional settings for plugin loading, including development mode manifests or other configurations.
    • loadPluginFromProperties

      @VisibleForTesting public static void loadPluginFromProperties(Properties props) throws ClassNotFoundException
      Load plugin for test.

      WARN: don't use it for general purpose.

      Parameters:
      props - properties that have "plugin=(classes...)"
      Throws:
      ClassNotFoundException - when specified plugin is not found.
    • getFilterClasses

      public static List<Class<?>> getFilterClasses()
      Retrieves a list of filter classes.
      Returns:
      a list of filter class objects
    • getTokenizerClasses

      public static List<Class<?>> getTokenizerClasses()
      Retrieves a list of tokenizer classes available in the system.
      Returns:
      a list of classes representing tokenizer implementations.
    • getSpellCheckClasses

      public static List<Class<?>> getSpellCheckClasses()
      Retrieves a list of spellchecker classes available in the system.
      Returns:
      a list of classes representing spellchecker implementations.
    • getTokenizerClassForLanguage

      public static Class<?> getTokenizerClassForLanguage(Language lang)
      Retrieves the tokenizer class for a given language.
      Parameters:
      lang - the language for which to retrieve the tokenizer class
      Returns:
      the tokenizer class for the specified language, or the default tokenizer class if no specific tokenizer is found
    • getMarkerClasses

      public static List<Class<?>> getMarkerClasses()
    • getMachineTranslationClasses

      public static List<Class<?>> getMachineTranslationClasses()
    • getGlossaryClasses

      public static List<Class<?>> getGlossaryClasses()
    • getAutoCompleterViewsClasses

      public static List<Class<?>> getAutoCompleterViewsClasses()
    • getClassLoader

      public static @Nullable ClassLoader getClassLoader(PluginUtils.PluginType type)
      Retrieves the ClassLoader associated with the specified PluginUtils.PluginType. If the provided plugin type is UNKNOWN, the method returns null.
      Parameters:
      type - the PluginUtils.PluginType for which the class loader is needed.
      Returns:
      the ClassLoader associated with the specified plugin type, or null if the type is UNKNOWN.
    • unloadPlugins

      public static void unloadPlugins()
    • getPluginInformations

      public static Collection<PluginInformation> getPluginInformations()
      Get the list of plugin information.
      Returns:
      the list of plugin information.
    • getJarFileUrlFromResourceUrl

      public static URL getJarFileUrlFromResourceUrl(URL url) throws IOException
      Get the list of loaded plugins.
      Parameters:
      url - the resource URL
      Returns:
      the jar file URL from the resource URL
      Throws:
      IOException - if an I/O error occurs