+ return Collections.unmodifiableList(nodes);
+ }
+
+ /**
+ * Returns the high-level client for a given node.
+ *
+ * @param node
+ * The node to get a high-level client for
+ * @return The high-level client for a node, or <code>null</code> if the
+ * node was disconnected or removed
+ */
+ public HighLevelClient getHighLevelClient(Node node) {
+ return nodeClients.get(node);
+ }
+
+ /**
+ * Returns the node for a high-level client.
+ *
+ * @param highLevelClient
+ * The high-level client to get the node for
+ * @return The node for the high-level client, or <code>null</code> if the
+ * high-level client is not known
+ */
+ public Node getNode(HighLevelClient highLevelClient) {
+ return clientNodes.get(highLevelClient);
+ }
+
+ /**
+ * 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
+ * public key at index <code>1</code>
+ * @throws IOException
+ * if an I/O error occurs communicating with the node
+ * @throws JSiteException
+ * if there is a problem with the node
+ */
+ public String[] generateKeyPair() throws IOException, JSiteException {
+ logger.log(Level.FINEST, "generateKeyPair()");
+ if (nodes.isEmpty()) {
+ throw new NoNodeException("no node configured");
+ }
+ Node node = nodes.get(0);
+ HighLevelClient highLevelClient = nodeClients.get(node);
+ try {
+ KeyGenerationResult keyGenerationResult = highLevelClient.generateKey().getResult();
+ return new String[] { keyGenerationResult.getInsertURI(), keyGenerationResult.getRequestURI() };
+ } catch (HighLevelException hle1) {
+ throw new BackendException(hle1);
+ } catch (InterruptedException e) {
+ /* ignore. */
+ }
+ return null;