/** * Establish additional locations that Sword may hold books. * * @param theNewDirs * The new Sword directories * @throws BookException */ public static void setAugmentPath(File[] theNewDirs) throws BookException { File[] newDirs = theNewDirs; if (newDirs == null) { return; } SwordBookPath.augmentPath = newDirs.clone(); // Now we need to (re)register ourselves Books.installed().registerDriver(SwordBookDriver.instance()); }
/** * Registers all the drivers known to the program. */ private void autoRegister() { // This will classload them all and they will register themselves. Class<? extends BookDriver>[] types = PluginUtil.getImplementors(BookDriver.class); log.debug("begin auto-registering {} drivers:", Integer.toString(types.length)); for (int i = 0; i < types.length; i++) { // job.setProgress(Msg.JOB_DRIVER.toString() + // ClassUtils.getShortClassName(types[i])); try { Method driverInstance = types[i].getMethod("instance", new Class[0]); BookDriver driver = (BookDriver) driverInstance.invoke(null, new Object[0]); // types[i].newInstance(); registerDriver(driver); } catch (NoSuchMethodException e) { Reporter.informUser(Books.class, e); } catch (IllegalArgumentException e) { Reporter.informUser(Books.class, e); } catch (IllegalAccessException e) { Reporter.informUser(Books.class, e); } catch (InvocationTargetException e) { Reporter.informUser(Books.class, e); } catch (BookException e) { Reporter.informUser(Books.class, e); } } }