Bundle Loader
Entry point for discovering and loading KSLModelBundle instances.
Three sources are supported:
loadJar— a single JAR fileloadDirectory— every.jarfile directly inside a directoryloadFromClasspath— bundles already visible to aClassLoaderon the running JVM's classpath
Discovery uses the standard java.util.ServiceLoader mechanism against META-INF/services/ksl.app.bundle.KSLModelBundle. JARs without a services registration are not bundles; loadJar returns an empty list for them. Pre-bundle JARs holding bare ksl.simulation.ModelBuilderIfc classes are loaded through the separate ksl.utilities.io.JARModelBuilder API instead.
loadJar and loadDirectory create a fresh URLClassLoader per JAR and hand it to each discovered LoadedBundle; the bundles' close releases it. If a single JAR declares multiple bundles, all returned LoadedBundles share that classloader and should be closed as a group.
Functions
Default parent classloader: the one that loaded KSLCore.
Loads bundles from every .jar file directly inside dir (non-recursive). Empty list if the directory is missing or contains no JARs. JARs whose loadJar throws are skipped with a warning so one bad bundle never breaks startup discovery.
Loads bundles already visible to classLoader (default: the loader that holds KSLCore). Used to surface in-process bundled examples that ship as part of the application's classpath rather than as separate JAR files. Returned bundles have sourceJar == null and bypass the on-disk cache; in-JAR descriptors are still consulted via getResourceAsStream.
Loads every bundle declared in jarPath via ServiceLoader. Each returned LoadedBundle owns the freshly-created classloader; if the JAR declares multiple bundles they share the loader.