if (myClassLoader == null) {
return;
}
ClassManager classManager =
getClassManager(jarPath, myClassLoader, errors);
if (classManager == null) {
return;
}
JarContainer theJarContainer = jars.get(jarPath);
long modified = getModified(jarPath, errors);
// Check to see if he have seen this Jar before
if ((theJarContainer == null) ||
(theJarContainer.modified != modified)) {
if (theJarContainer != null) {
theJarContainer.classManager.unload(this);
}
theJarContainer = new JarContainer(extName, jarPath, myClassLoader, modified);
try {
// compilation tests shouldn't initialize the extension
if (!workspace.compilerTestingMode()) {
classManager.runOnce(this);
}
} catch (org.nlogo.api.ExtensionException ex) {
System.err.println("Error while initializing extension.");
System.err.println("Error is: " + ex);
throw ex;
}
jars.put(jarPath, theJarContainer);
}
// Check to see if it has been loaded into the model
if (!theJarContainer.loaded) {
jarsLoaded++;
theJarContainer.loaded = true;
theJarContainer.classManager = classManager;
theJarContainer.primManager = new ExtensionPrimitiveManager(extName);
classManager.load(theJarContainer.primManager);
}
// Jars that have been removed won't get this flag set
theJarContainer.live = true;