/** * Load a {@link ServiceRegistrarFactory} using the current class loader. * * @return A {@link ServiceRegistrarFactory}, null if none could be found. * * @throws ServiceRegistrarLoadingException if loading failed. */ public static ServiceRegistrarFactory load() throws ServiceRegistrarLoadingException { return load("classpath", CURRENT); }
/** * Load a {@link ServiceRegistrarFactory} from a plugin jar file with a parent class loader that * will not load classes from the jvm classpath. Any dependencies of the plugin must be included * in the plugin jar. * * @param plugin The plugin jar file to load. * * @return A {@link ServiceRegistrarFactory}, null if none could be found. * * @throws ServiceRegistrarLoadingException if loading failed. */ public static ServiceRegistrarFactory load(final Path plugin) throws ServiceRegistrarLoadingException { return load(plugin, CURRENT, extensionClassLoader(CURRENT)); }
/** * Load a {@link ServiceRegistrarFactory} from a plugin jar file with a specified parent class * loader and a list of exposed classes. * * @param plugin The plugin jar file to load. * @param environment The class loader to use for providing plugin interface dependencies. * @param parent The parent class loader to assign to the class loader of the jar. * * @return A {@link ServiceRegistrarFactory}, null if none could be found. * * @throws ServiceRegistrarLoadingException if loading failed. */ public static ServiceRegistrarFactory load(final Path plugin, final ClassLoader environment, final ClassLoader parent) throws ServiceRegistrarLoadingException { return load("plugin jar file: " + plugin, pluginClassLoader(plugin, environment, parent)); }
/** * Get a registrar factory from a plugin. * * @param path The path to the plugin jar. * * @return The ServiceRegistrarFactory object. */ private static ServiceRegistrarFactory createFactory(final Path path) { final ServiceRegistrarFactory factory; final Path absolutePath = path.toAbsolutePath(); try { factory = ServiceRegistrarLoader.load(absolutePath); final String name = factory.getClass().getName(); log.info("Loaded service registrar plugin: {} ({})", name, absolutePath); } catch (ServiceRegistrarLoadingException e) { throw new RuntimeException("Unable to load service registrar plugin: " + absolutePath, e); } return factory; }
/** * Load a {@link ServiceRegistrarFactory} from a plugin jar file with a parent class loader that * will not load classes from the jvm classpath. Any dependencies of the plugin must be included * in the plugin jar. * * @param plugin The plugin jar file to load. * @return A {@link ServiceRegistrarFactory}, null if none could be found. * @throws ServiceRegistrarLoadingException if loading failed. */ public static ServiceRegistrarFactory load(final Path plugin) throws ServiceRegistrarLoadingException { return load(plugin, CURRENT, extensionClassLoader(CURRENT)); }
/** * Load a {@link ServiceRegistrarFactory} from a plugin jar file with a specified parent class * loader and a list of exposed classes. * * @param plugin The plugin jar file to load. * @param environment The class loader to use for providing plugin interface dependencies. * @param parent The parent class loader to assign to the class loader of the jar. * @return A {@link ServiceRegistrarFactory}, null if none could be found. * @throws ServiceRegistrarLoadingException if loading failed. */ public static ServiceRegistrarFactory load(final Path plugin, final ClassLoader environment, final ClassLoader parent) throws ServiceRegistrarLoadingException { return load("plugin jar file: " + plugin, pluginClassLoader(plugin, environment, parent)); }
/** * Get a registrar factory from the application class loader. * * @return The ServiceRegistrarFactory object. */ private static ServiceRegistrarFactory createFactory() { final ServiceRegistrarFactory factory; final ServiceRegistrarFactory installed; try { installed = ServiceRegistrarLoader.load(); } catch (ServiceRegistrarLoadingException e) { throw new RuntimeException("Unable to load service registrar", e); } if (installed == null) { log.debug("No service registrar plugin configured"); factory = new NopServiceRegistrarFactory(); } else { factory = installed; final String name = factory.getClass().getName(); log.info("Loaded installed service registrar: {}", name); } return factory; } }
/** * Load a {@link ServiceRegistrarFactory} using the current class loader. * * @return A {@link ServiceRegistrarFactory}, null if none could be found. * @throws ServiceRegistrarLoadingException if loading failed. */ public static ServiceRegistrarFactory load() throws ServiceRegistrarLoadingException { return load("classpath", CURRENT); }
/** * Get a registrar factory from a plugin. * * @param path The path to the plugin jar. * @return The ServiceRegistrarFactory object. */ private static ServiceRegistrarFactory createFactory(final Path path) { final ServiceRegistrarFactory factory; final Path absolutePath = path.toAbsolutePath(); try { factory = ServiceRegistrarLoader.load(absolutePath); final String name = factory.getClass().getName(); log.info("Loaded service registrar plugin: {} ({})", name, absolutePath); } catch (ServiceRegistrarLoadingException e) { throw new RuntimeException("Unable to load service registrar plugin: " + absolutePath, e); } return factory; }
/** * Get a registrar factory from the application class loader. * * @return The ServiceRegistrarFactory object. */ private static ServiceRegistrarFactory createFactory() { final ServiceRegistrarFactory factory; final ServiceRegistrarFactory installed; try { installed = ServiceRegistrarLoader.load(); } catch (ServiceRegistrarLoadingException e) { throw new RuntimeException("Unable to load service registrar", e); } if (installed == null) { log.debug("No service registrar plugin configured"); factory = new NopServiceRegistrarFactory(); } else { factory = installed; final String name = factory.getClass().getName(); log.info("Loaded installed service registrar: {}", name); } return factory; } }