/** * Laedt eine Konfigurationsdatei und fuegt markierte Multicasts hinzu. * * @param path Pfad zur Konfigurationsdatei, die geladen werden soll. * @param complete Wenn hier true gesetzt ist, wird der Standardpfad genommen und MCD + UID + ULD * geladen. * @param Sender_v4 Wenn true wird Sender_v4 geladen. * @param Sender_v6 Wenn true wird Sender_v6 geladen. * @param Receiver_v4 Wenn true wird Receiver_v4 geladen. * @param Receiver_v6 Wenn true wird Receiver_v4 geladen. */ private void loadConfig( String path, boolean complete, boolean Sender_v4, boolean Sender_v6, boolean Receiver_v4, boolean Receiver_v6) { final String p = "MultiCastor.xml"; // Diese Vektoren werden geladen Vector<MulticastData> multicasts = new Vector<MulticastData>(); String message = new String(); boolean skip = false; if (complete) { try { xml_parser.loadConfig(p, multicasts, userlevelData, userInputData, lastConfigs); logger.log(Level.INFO, "Default Configurationfile loaded."); } catch (Exception e) { if (e instanceof FileNotFoundException) { message = "Default configurationfile was not found. MultiCastor starts without preconfigured Multicasts and with default GUI configuration."; } else if (e instanceof SAXException) { message = "Default configurationfile could not be parsed correctly. MultiCastor starts without preconfigured Multicasts and with default GUI configuration."; } else if (e instanceof IOException) { message = "Default configurationfile could not be loaded. MultiCastor starts without preconfigured Multicasts and with default GUI configuration."; } else if (e instanceof WrongConfigurationException) { message = ((WrongConfigurationException) e).getErrorMessage(); } else if (e instanceof IllegalArgumentException) { message = "Error in default configurationfile."; } else { message = "Unexpected error of type: " + e.getClass(); } skip = true; logger.log(Level.WARNING, message); } } else { try { xml_parser.loadConfig(path, multicasts, userlevelData); logger.log(Level.INFO, "Configurationfile loaded: " + path); } catch (Exception e) { if (e instanceof FileNotFoundException) { message = "Configurationfile not found."; } else if (e instanceof SAXException) { message = "Configurationfile could not be parsed."; } else if (e instanceof IOException) { message = "Configurationfile could not be loaded."; } else if (e instanceof WrongConfigurationException) { message = ((WrongConfigurationException) e).getErrorMessage(); } else if (e instanceof IllegalArgumentException) { message = "Error in configurationfile."; } else { message = "Unexpected error of type: " + e.getClass(); } skip = true; message = message + " Used path: " + path; logger.log(Level.WARNING, message); } } if (!skip) { // Füge Multicast hinzu for (MulticastData m : multicasts) { if (((m.getTyp().equals(Typ.RECEIVER_V4) && Receiver_v4)) || ((m.getTyp().equals(Typ.RECEIVER_V6) && Receiver_v6)) || ((m.getTyp().equals(Typ.SENDER_V4) && Sender_v4)) || ((m.getTyp().equals(Typ.SENDER_V6) && Sender_v6))) { view_controller.addMC(m); } } if (userlevelData.size() < 4) { // log("Error in loadConfigFile - ConfigFile did not contain 12 userLevelData objects (this // is ignored for test purposes)"); logger.log( Level.INFO, "In the Configfile were less than 4 UserlevelData objects. Default ULD will be used."); } } view_controller.loadAutoSave(); }