Changeset 2232 for trunk/autoquest-plugin-core/src
- Timestamp:
- 12/07/17 17:08:59 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-core/src/main/java/de/ugoe/cs/autoquest/plugin/PluginLoader.java
r2230 r2232 97 97 }); 98 98 99 for (File jarFile : jarFiles) { 100 updateClassLoader(jarFile); 101 102 String pluginName = jarFile.getName().split("-")[2]; 103 String pluginClassName = "de.ugoe.cs.autoquest.plugin." + pluginName 104 + "." + pluginName.toUpperCase() + "Plugin"; 105 106 Class<?> pluginClass = null; 107 try { 108 pluginClass = Class.forName(pluginClassName); 109 } catch (ClassNotFoundException e) { 110 throw new PluginLoaderException("No class '" + pluginClassName 111 + "' found in " + pluginDir + "/" + jarFile.getName()); 112 } 113 try { 114 AutoQUESTPlugin pluginObject = (AutoQUESTPlugin) pluginClass 115 .newInstance(); 116 plugins.add(pluginObject); 117 } catch (InstantiationException e) { 118 throw new PluginLoaderException("Could not instantiate " 119 + pluginClassName); 120 } catch (IllegalAccessException e) { 121 throw new PluginLoaderException("Could not access " 122 + pluginClassName); 123 } catch (ClassCastException e) { 124 throw new PluginLoaderException("Class " + pluginClassName 125 + " not instance of AutoQUESTPlugin"); 99 if (jarFiles != null) { 100 for (File jarFile : jarFiles) { 101 updateClassLoader(jarFile); 102 103 String pluginName = jarFile.getName().split("-")[2]; 104 String pluginClassName = "de.ugoe.cs.autoquest.plugin." + pluginName 105 + "." + pluginName.toUpperCase() + "Plugin"; 106 107 Class<?> pluginClass = null; 108 try { 109 pluginClass = Class.forName(pluginClassName); 110 } catch (ClassNotFoundException e) { 111 throw new PluginLoaderException("No class '" + pluginClassName 112 + "' found in " + pluginDir + "/" + jarFile.getName()); 113 } 114 try { 115 AutoQUESTPlugin pluginObject = (AutoQUESTPlugin) pluginClass 116 .newInstance(); 117 plugins.add(pluginObject); 118 } catch (InstantiationException e) { 119 throw new PluginLoaderException("Could not instantiate " 120 + pluginClassName); 121 } catch (IllegalAccessException e) { 122 throw new PluginLoaderException("Could not access " 123 + pluginClassName); 124 } catch (ClassCastException e) { 125 throw new PluginLoaderException("Class " + pluginClassName 126 + " not instance of AutoQUESTPlugin"); 127 } 126 128 } 127 129 }
Note: See TracChangeset
for help on using the changeset viewer.