Class Registration

java.lang.Object
eu.qualimaster.easy.extension.internal.Registration
All Implemented Interfaces:
net.ssehub.easy.instantiation.core.model.vilTypes.IRegistration

public class Registration extends Object implements net.ssehub.easy.instantiation.core.model.vilTypes.IRegistration
Registers QM Java additions to EASy-Producer, in particular to rt-VIL. Unless configured otherwise, it reads a list of class names as a resource produced by just executing this class. This bridges QM-specific classes with EASy-Producer (original OSGI execution), as well as infrastructure execution (OSGI through standalone). In the EASy case, the underlying classes are taken from the bundle classpath. For the standalone execution, the libraries are left out while bundling and before Maven deployment and taken from the actual infrastructure. For executing within EASy standalone (QM), it is safe to assume that the OSGI interfaces are present.
Author:
Holger Eichelberger
  • Field Details

  • Constructor Details

    • Registration

      public Registration()
  • Method Details

    • obtainStreamFromClassLoader

      private static void obtainStreamFromClassLoader(ClassLoader loader, String name, List<JarInputStream> result)
      Obtains a JAR file from a resource stream.
      Parameters:
      loader - the class loader to consider
      name - the name of the resource
      result - the JAR files to be modified as a side effect
    • getJars

      private static List<JarInputStream> getJars(ClassLoader loader, String jarLocations)
      Returns the relevant JAR files.
      Parameters:
      loader - the class loader to use
      jarLocations - optional (authoritive) Jar locations to search separated by pathSeparator, use null to ignore
      Returns:
      the relevant JAR files
    • readClassList

      private static void readClassList(List<Class<?>> classes, ClassLoader loader, String prefix)
      Reads the class list to determine the classes to import from RESOURCE_CLASS_LIST.
      Parameters:
      classes - the class list (modified as a side effect)
      loader - the class loader
      prefix - to be used where the resource is located in
    • scanJars

      private static void scanJars(List<Class<?>> classes, String jarLocations, ClassLoader loader)
      Scans given JAR files for classes to import.
      Parameters:
      classes - the class list (modified as a side effect)
      jarLocations - optional (authoritive) Jar locations to search separated by pathSeparator, use null to ignore
      loader - the class loader
    • writeClassList

      private static void writeClassList(List<Class<?>> classes)
      Writes the classes list to RESOURCE_CLASS_LIST.
      Parameters:
      classes - the classes to write
    • setClassLoader

      public static final void setClassLoader(ClassLoader userLoader)
      Explicitly sets the class loader.
      Parameters:
      userLoader - the class loader to use (ignored if null)
    • register

      public static final void register(String jarLocations)
      Registers the Java artifacts, instantiators and types.
      Parameters:
      jarLocations - optional (authoritative) Jar locations to search separated by pathSeparator, use null to ignore
    • printOperations

      private static void printOperations(net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<?> desc)
      Prints all operations in desc.
      Parameters:
      desc - the descriptor to print the operations for
    • isQmInternal

      private static boolean isQmInternal(Class<?> cls)
      Returns whether the class is marked as internal to the QualiMaster infrastructure.
      Parameters:
      cls - the class to consider
      Returns:
      true if the class is considered to be invisible
    • isQmSupport

      private static boolean isQmSupport(Class<?> cls)
      Returns whether the class is marked as support to the QualiMaster infrastructure.
      Parameters:
      cls - the class to consider
      Returns:
      true if the class is considered to be supporting
    • considerImporting

      private static void considerImporting(ClassLoader loader, String className, List<Class<?>> toImport)
      Considers a class for importing into rt-VIL.
      Parameters:
      loader - the class loader to use
      className - the name of the class
      toImport - the classes to import (modified as a side effect)
    • printClasses

      private static void printClasses(List<Class<?>> toPrint)
      Prints a list of classes.
      Parameters:
      toPrint - the classes to print (may be null then ignored)
    • activate

      protected void activate(org.osgi.service.component.ComponentContext context)
      Private method to activate plugin.
      Parameters:
      context - Context.
    • registerType

      private static void registerType(Class<? extends net.ssehub.easy.instantiation.core.model.vilTypes.IVilType> cls, List<Class<?>> classes)
      Registers a single type.
      Parameters:
      cls - the class to register; use QM annotations instead of VIL annotations!
      classes - optional set to collect registered classes, may be null for no recording
    • registerInstantiator

      private static void registerInstantiator(Class<? extends net.ssehub.easy.instantiation.core.model.vilTypes.IVilType> cls, List<net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<?>> instantiators)
      Handles the registration of an instantiator.
      Parameters:
      cls - the class to be registered
      instantiators - the instantiators (modified as a side effect)
    • deactivate

      protected void deactivate(org.osgi.service.component.ComponentContext context)
      Private method to to de-activate plugin.
      Parameters:
      context - Context.
    • main

      public static void main(String[] args)
      Just for testing / debugging.
      Parameters:
      args - ignored for convenience
    • error

      public static void error(String message)
      Logs an error.
      Parameters:
      message - the error message