Class AbstractLoader

java.lang.Object
de.uni_hildesheim.sse.easy.loader.AbstractLoader
Direct Known Subclasses:
Analyzer, Generator, Loader

public abstract class AbstractLoader extends Object
Provides common functionality for an EASy loader.
Author:
Holger Eichelberger
  • Field Details

  • Constructor Details

    • AbstractLoader

      protected AbstractLoader(File base)
      Creates a new abstract loader.
      Parameters:
      base - the base folder where the plugins are located in
  • Method Details

    • initializeRegistry

      protected static void initializeRegistry()
      Initializes the BundleRegistry.
    • bootstrap

      protected void bootstrap(File baseDir, File easyPlugins, File eclipsePlugins)
      Bootstraps EASy using the default bootstrap method.
      Parameters:
      baseDir - the BaseDir for the bootstrap.
      easyPlugins - File of the easy plugins. If null, the base/plugins/ folder will be used.
      eclipsePlugins - File of the eclipse Plugins. If null, the base/plugins/eclipse folder will be used.
    • simpleBootstrap

      protected void simpleBootstrap(File easyPlugins, File eclipsePlugins)
      Does bootstrapping having bundles in local folders.
      Parameters:
      easyPlugins - File of the easy plugins. If null, the base/plugins/ folder will be used.
      eclipsePlugins - File of the eclipse Plugins. If null, the base/plugins/eclipse folder will be used.
    • genericBootstrap

      protected void genericBootstrap()
      Generic bootstrapping from eclipse.
    • printDependencies

      protected void printDependencies(BundleInfo info, String indent)
      Recursively prints the dependencies of info.
      Parameters:
      info - the object to print the dependencies for
      indent - the current indentation
    • getUiBundles

      protected static List<BundleInfo> getUiBundles()
      Returns possible UI bundles.
      Returns:
      the possible ui bundles (may be empty)
    • collectBootstrapData

      protected void collectBootstrapData(BundleInfo info, List<URL> urls, List<BundleInfo> instantiate, Set<BundleInfo> done, Object tag)
      Collect the bootstrap data.
      Parameters:
      info - the bundle information object to consider
      urls - the jar files to load (modified as a side effect)
      instantiate - the bundles to instantiate, either via activator or DS (modified as a side effect)
      done - the already considered bundles (modified as a side effect)
      tag - an optional bundle tag for filtering relevant bundles (may be null)
    • collectBootstrapData

      private void collectBootstrapData(BundleInfo info, List<URL> urls, List<BundleInfo> instantiate, Object tag)
      Collect the bootstrap data for info. This method is called by collectBootstrapData(BundleInfo, List, List, Set, Object).
      Parameters:
      info - the bundle information object to consider
      urls - the jar files to load (modified as a side effect)
      instantiate - the bundles to instantiate, either via activator or DS (modified as a side effect)
      tag - an optional bundle tag for filtering relevant bundles (may be null)
    • notifyMapping

      protected void notifyMapping(URL url, BundleInfo info)
      Is called by collectBootstrapData(BundleInfo, List, List, Object) to notify about mapping a URL to the given bundle info.
      Parameters:
      url - the URL of the bundle JAR
      info - the related bundle information object
    • alreadyKnownToClassLoader

      private static boolean alreadyKnownToClassLoader(BundleInfo info)
      Returns whether the given bundle is already known to the class loader. This method relies on BundleInfo.getSampleClass().
      Parameters:
      info - the info to be tested
      Returns:
      true if the bundle is already known, false else
    • alreadyKnownToClassLoader

      private static boolean alreadyKnownToClassLoader(String sampleClass)
      Returns whether the given (sample) class is already known to the class loader.
      Parameters:
      sampleClass - the sample class to be tested
      Returns:
      true if the bundle is already known, false else
    • alreadyKnownToClassLoader

      private static boolean alreadyKnownToClassLoader(File file)
      Returns whether the given (JAR) file is already known to the class loader.
      Parameters:
      file - the JAR file to be tested
      Returns:
      true if the bundle is already known, false else
    • handleBundleClasspath

      private void handleBundleClasspath(BundleInfo info, List<URL> urls) throws MalformedURLException
      Handles the classpath of the given bundle.
      Parameters:
      info - the bundle information object
      urls - the URLs (to be modified as a side effect)
      Throws:
      MalformedURLException - in case that the URL cannot be created
    • considerForBootstrap

      private static boolean considerForBootstrap(BundleInfo info, Object tag)
      Returns whether the given bundle shall be considered for the bootstrap process.
      Parameters:
      info - the bundle information object
      tag - the optional tag (may be null)
      Returns:
      true if info shall be considered, false else
    • irrelevantInJar

      protected boolean irrelevantInJar(String name)
      Returns whether the name of a certain JAR entry is irrelevant for a standalone execution.
      Parameters:
      name - the name
      Returns:
      true if the name (and potential overlapping names) is irrelevant, false if relevant
    • getBase

      protected File getBase()
      Returns the base folder.
      Returns:
      the base folder