/** * Should parse a string to select, initialize, and return the user interface selected * * @param optionValue the string to parse * @return the user interface to use */ private void selectUI(String optionValue) { try { Class<?> cls = Class.forName("com.kpro.ui." + optionValue); userInterface = (UserIO) cls.newInstance(); } catch (Exception e) { System.err.println("Selected UserIO not found"); } }
/** * Starts the NetworkR specificied by the configuration settings. * * @throws ClassNotFoundException * @throws InvocationTargetException * @throws IllegalAccessException * @throws InstantiationException * @throws SecurityException * @throws IllegalArgumentException */ private void startNetwork() throws ClassNotFoundException, IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException { // System.err.println("startnetwork called"); Class<?> cls = Class.forName("com.kpro.datastorage." + genProps.getProperty("NetworkRType")); if (cls == null) { System.err.println("NetworkRType incorrect- null in Gio.startNetwork()"); } nr = (NetworkR) cls.getDeclaredConstructors()[0].newInstance(genProps.getProperty("NetworkROptions")); // System.err.println("nr in startNetwork="+nr); }
/** * 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"); } }