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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classImplements a class name comparator (for debugging).private static interfaceA simple logging abstractor. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final TypeAnalyzerprivate static final Stringprivate static booleanprivate static ClassLoaderprivate static final Registration.Loggingstatic final Stringprivate static booleanstatic final Stringprivate static boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactivate(org.osgi.service.component.ComponentContext context) Private method to activate plugin.private static voidconsiderImporting(ClassLoader loader, String className, List<Class<?>> toImport) Considers a class for importing into rt-VIL.protected voiddeactivate(org.osgi.service.component.ComponentContext context) Private method to to de-activate plugin.static voidLogs an error.private static List<JarInputStream> getJars(ClassLoader loader, String jarLocations) Returns the relevant JAR files.private static booleanisQmInternal(Class<?> cls) Returns whether the class is marked as internal to the QualiMaster infrastructure.private static booleanisQmSupport(Class<?> cls) Returns whether the class is marked as support to the QualiMaster infrastructure.static voidJust for testing / debugging.private static voidobtainStreamFromClassLoader(ClassLoader loader, String name, List<JarInputStream> result) Obtains a JAR file from a resource stream.private static voidprintClasses(List<Class<?>> toPrint) Prints a list of classes.private static voidprintOperations(net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<?> desc) Prints all operations indesc.private static voidreadClassList(List<Class<?>> classes, ClassLoader loader, String prefix) Reads the class list to determine the classes to import fromRESOURCE_CLASS_LIST.static final voidRegisters the Java artifacts, instantiators and types.private static voidregisterInstantiator(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.private static voidregisterType(Class<? extends net.ssehub.easy.instantiation.core.model.vilTypes.IVilType> cls, List<Class<?>> classes) Registers a single type.private static voidscanJars(List<Class<?>> classes, String jarLocations, ClassLoader loader) Scans given JAR files for classes to import.static final voidsetClassLoader(ClassLoader userLoader) Explicitly sets the class loader.private static voidwriteClassList(List<Class<?>> classes) Writes the classes list toRESOURCE_CLASS_LIST.
-
Field Details
-
QM_LIB_PROPERTY
- See Also:
-
RESOURCE_CLASS_LIST
- See Also:
-
CLASS_EXTENSION
- See Also:
-
LOGGING
-
ANALYZER
-
registered
private static boolean registered -
debug
private static boolean debug -
loader
-
writeOutput
private static boolean writeOutput
-
-
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 considername- the name of the resourceresult- the JAR files to be modified as a side effect
-
getJars
Returns the relevant JAR files.- Parameters:
loader- the class loader to usejarLocations- optional (authoritive) Jar locations to search separated by pathSeparator, use null to ignore- Returns:
- the relevant JAR files
-
readClassList
Reads the class list to determine the classes to import fromRESOURCE_CLASS_LIST.- Parameters:
classes- the class list (modified as a side effect)loader- the class loaderprefix- to be used where the resource is located in
-
scanJars
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 ignoreloader- the class loader
-
writeClassList
Writes the classes list toRESOURCE_CLASS_LIST.- Parameters:
classes- the classes to write
-
setClassLoader
Explicitly sets the class loader.- Parameters:
userLoader- the class loader to use (ignored if null)
-
register
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 indesc.- Parameters:
desc- the descriptor to print the operations for
-
isQmInternal
Returns whether the class is marked as internal to the QualiMaster infrastructure.- Parameters:
cls- the class to consider- Returns:
trueif the class is considered to be invisible
-
isQmSupport
Returns whether the class is marked as support to the QualiMaster infrastructure.- Parameters:
cls- the class to consider- Returns:
trueif 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 useclassName- the name of the classtoImport- the classes to import (modified as a side effect)
-
printClasses
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 registeredinstantiators- 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
Just for testing / debugging.- Parameters:
args- ignored for convenience
-
error
Logs an error.- Parameters:
message- the error message
-