- return reply;
- }
-
- /**
- * Notifies the connector that a plugin reply was received.
- *
- * @param receivedReplyEvent
- * The event
- */
- @Subscribe
- public void receivedReply(ReceivedReplyEvent receivedReplyEvent) {
- PluginIdentifier pluginIdentifier = new PluginIdentifier(receivedReplyEvent.pluginName(), receivedReplyEvent.identifier());
- Reply reply = replies.remove(pluginIdentifier);
- if (reply == null) {
- return;
- }
- logger.log(Level.FINEST, String.format("Received Reply from Plugin: %s", receivedReplyEvent.fieldSet().get("Message")));
- synchronized (reply) {
- reply.setFields(receivedReplyEvent.fieldSet());
- reply.setData(receivedReplyEvent.data());
- reply.notify();
- }
- }
-
- /**
- * Container for the data of the reply from a plugin.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
- */
- private static class Reply {
-
- /** The fields of the reply. */
- private SimpleFieldSet fields;
-
- /** The payload of the reply. */
- private Bucket data;
-
- /** Empty constructor. */
- public Reply() {
- /* do nothing. */
- }
-
- /**
- * Returns the fields of the reply.
- *
- * @return The fields of the reply
- */
- public SimpleFieldSet getFields() {
- return fields;
- }
-
- /**
- * Sets the fields of the reply.
- *
- * @param fields
- * The fields of the reply
- */
- public void setFields(SimpleFieldSet fields) {
- this.fields = fields;
- }
-
- /**
- * Returns the payload of the reply.
- *
- * @return The payload of the reply (may be {@code null})
- */
- @SuppressWarnings("unused")
- public Bucket getData() {
- return data;
- }
-
- /**
- * Sets the payload of the reply.
- *
- * @param data
- * The payload of the reply (may be {@code null})
- */
- public void setData(Bucket data) {
- this.data = data;
- }
-