@Override public synchronized Document onNetconfMessage(Document message, NetconfSession session) throws NetconfDocumentedException { Preconditions.checkNotNull( allNetconfOperations, "Operation router was not initialized properly"); NetconfOperationExecution netconfOperationExecution; String messageAsString = XmlUtil.toString(message); try { netconfOperationExecution = getNetconfOperationWithHighestPriority(message, session); } catch (IllegalArgumentException | IllegalStateException e) { logger.warn("Unable to handle rpc {} on session {}", messageAsString, session, e); String errorMessage = String.format("Unable to handle rpc %s on session %s", messageAsString, session); Map<String, String> errorInfo = Maps.newHashMap(); NetconfDocumentedException.ErrorTag tag = null; if (e instanceof IllegalArgumentException) { errorInfo.put( NetconfDocumentedException.ErrorTag.operation_not_supported.toString(), e.getMessage()); tag = NetconfDocumentedException.ErrorTag.operation_not_supported; } else if (e instanceof IllegalStateException) { errorInfo.put( NetconfDocumentedException.ErrorTag.operation_failed.toString(), e.getMessage()); tag = NetconfDocumentedException.ErrorTag.operation_failed; } throw new NetconfDocumentedException( errorMessage, e, NetconfDocumentedException.ErrorType.application, tag, NetconfDocumentedException.ErrorSeverity.error, errorInfo); } catch (RuntimeException e) { throw handleUnexpectedEx("Unexpected exception during netconf operation sort", e); } try { return executeOperationWithHighestPriority( message, netconfOperationExecution, messageAsString); } catch (RuntimeException e) { throw handleUnexpectedEx("Unexpected exception during netconf operation execution", e); } }
@Override public void onEnable() { log = Bukkit.getServer().getConsoleSender(); log.sendMessage(ChatColor.DARK_GREEN + "========BungeeSuite Enabling========"); log.sendMessage(ChatColor.GREEN + "- Loading Config"); loadConfig(); log.sendMessage(ChatColor.GREEN + "- Initialising Variables"); try { initialiseVariables(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } log.sendMessage(ChatColor.GREEN + "- Registering Plugin Channels"); registerPluginChannels(); log.sendMessage(ChatColor.GREEN + "- Registering Listeners"); registerListeners(); try { utils.setOnline(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (usingSigns) { try { BukkitTask task = new SignHandler(this).runTaskTimer(this, 100, signUpdatePeriod); } catch (IllegalArgumentException | IllegalStateException | SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (dynamicMOTD) { BukkitTask updateMOTD = new MOTDUpdater(this).runTaskTimerAsynchronously(this, 100, MOTDUpdatePeriod); } }