Class ParentLastClassloader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.qubership.atp.environments.db.migration.classloader.ParentLastClassloader
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionParentLastClassloader(String sourcePath, String jdbcType) ClassLoader based onURLClassLoaderfor loading classes from self. -
Method Summary
Modifier and TypeMethodDescriptiongetResources(String name) Class<?> Load class from current classloader.protected voidrefreshClassLoader(String className) Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstanceMethods inherited from class java.security.SecureClassLoader
defineClass, defineClassMethods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
ParentLastClassloader
ClassLoader based onURLClassLoaderfor loading classes from self. In case class not found in this CL, it will try to load it from parent CL.- Parameters:
sourcePath- - location of resources. update.xml, migration scripts/jars etc. For example: ./scripts/jdbcType- - type of database. This parameter need for loading generated q-classes. If you want use postgres database, and your jar with classes has name env-q-classes-generation-pg.jar, then you must define jdbcType=pg When CL trying to load jar, it split the name on three parts: 1. general name = env-q-classes-generation 2. suffix = pg 3. extension = .jar The suffix must match to jdbcType for loading this jar. So, you can check how it works in methodgetUrlClassLoader(List).
-
-
Method Details
-
getResources
- Overrides:
getResourcesin classClassLoader- Throws:
IOException
-
loadClass
Load class from current classloader. In case the liquibase started executing new one changeset, then classloader will load compatible jars with q-classes and shaded jar with required dependencies. So, if package start with v000.TICKET671.CustomChangeSet Then classloader will load jars fromsourcePath/v000/TICKET671 Which of q-classes jar will be loaded? It depends ofjdbc_type.- Overrides:
loadClassin classClassLoader- Parameters:
className- target class name.- Returns:
- the
Class - Throws:
ClassNotFoundException- in case Class not found in current and parent classloader.
-
refreshClassLoader
-