private Torrent loadTorrent(String res) { ClassLoader cl = this.getClass().getClassLoader(); InputStream is = cl.getResourceAsStream(res); if (is != null) { try { return plugin_interface.getTorrentManager().createFromBEncodedInputStream(is); } catch (Exception e) { Logger.info("System: The channel torrent is impossible to create!"); return null; } } Logger.info("System: The channel torrent created is null"); return null; }
@Override public void onMessage(final Message request) { TextMessage textRequest = (TextMessage) request; String text; try { text = textRequest.getText(); Logger.info("Salmon Content service:" + text + ";"); JSONObject record = new JSONObject(text); if (record.has("request")) handleRequest(record); else if (record.has("response")) handleResponse(record); else if (record.has("bullyMessageType") && record.has("action") && record.getString("action").equalsIgnoreCase("send")) handleBullyMessageType(record); } catch (JMSException e1) { e1.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } }