public static void executeMethodClass( String pathToJar, String pkg, String classToGet, String methodName, String pathToFile, long logIdSyncMin, long logIdSyncMax) throws IOException, ClassNotFoundException, SecurityException, InstantiationException, IllegalAccessException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException { Class<?> c = getClassFromJar(pathToJar, pkg, classToGet); Method method = c.getDeclaredMethod(methodName, String.class, long.class, long.class); method.invoke(null, pathToFile, logIdSyncMin, logIdSyncMax); }
/** * Should parse a string to select, initialize, and return one of the policy databases coded * * @param optionValue the string to parse * @return the policy database being used */ private void selectPDB(String optionValue) { try { Class<?> cls = Class.forName("com.kpro.datastorage." + optionValue); @SuppressWarnings("rawtypes") Class[] params = new Class[2]; params[0] = String.class; params[1] = String.class; Method m = cls.getDeclaredMethod("getInstance", params); Object[] argslist = new Object[2]; argslist[0] = genProps.getProperty("inDBLoc"); argslist[1] = genProps.getProperty("outDBLoc", genProps.getProperty("inDBLoc")); pdb = (PolicyDatabase) m.invoke(null, argslist); } catch (Exception e) { System.err.println("Selected PolicyDatabase not found"); } if (pdb == null) { System.err.println("pdb null in selectPDB"); } }