/** All nodes. */
private List<Node> nodes = Collections.synchronizedList(new ArrayList<Node>());
+ /** Map from node ID to node. */
+ private Map<String, Node> idNodes = Collections.synchronizedMap(new HashMap<String, Node>());
+
/** All FCP connections. */
private Map<Node, HighLevelClient> nodeClients = Collections.synchronizedMap(new HashMap<Node, HighLevelClient>());
node.addPropertyChangeListener(this);
HighLevelClient highLevelClient = new HighLevelClient(clientName);
nodes.add(node);
+ idNodes.put(node.getId(), node);
clientNodes.put(highLevelClient, node);
nodeClients.put(node, highLevelClient);
highLevelClient.addHighLevelClientListener(this);
disconnect(node);
}
nodes.remove(node);
+ idNodes.remove(node.getId());
node.removePropertyChangeListener(this);
fireNodeRemoved(node);
}
}
/**
+ * Returns the node identified by the given ID.
+ *
+ * @param id
+ * The ID of the node
+ * @return The node with the given ID, or <code>null</code> if no such
+ * node was found
+ */
+ Node getNode(String id) {
+ return idNodes.get(id);
+ }
+
+ /**
* Generates a new SSK key pair.
*
* @return An array with the private key at index <code>0</code> and the