From eeea1af877d2a2e0f05d396718df58c2650ca2c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 17 Jun 2011 15:33:21 +0200 Subject: [PATCH] (Current state.) --- .../pterodactylus/jsite/core/RequestManager.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/net/pterodactylus/jsite/core/RequestManager.java b/src/net/pterodactylus/jsite/core/RequestManager.java index df4d1cc..54ae5ac 100644 --- a/src/net/pterodactylus/jsite/core/RequestManager.java +++ b/src/net/pterodactylus/jsite/core/RequestManager.java @@ -98,6 +98,34 @@ public class RequestManager implements NodeListener { public void save() throws IOException { } + /** + * Starts inserting the given project. + * + * @param project + * The project to insert + * @throws JSiteException + * if the project’s node is not connected, or no node is + * connected at all + */ + public void insertProject(Project project) throws JSiteException { + Request request = new Request(); + request.setClientToken(generateClientToken(project)); + Node wantedNode = project.getNode(); + if (wantedNode == null) { + for (Node node : nodeManager.getNodes()) { + if (nodeManager.getFcpClient(node) != null) { + wantedNode = node; + break; + } + } + } + if (wantedNode == null) { + /* TODO use custom exception */ + throw new JSiteException("No node connected."); + } + FcpClient fcpClient = nodeManager.getFcpClient(wantedNode); + } + // // PRIVATE METHODS // -- 2.7.4