From cd8f9d14c972764e5e14ea43811744652a11dcd2 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 28 Oct 2011 08:09:55 -0400
Subject: [PATCH] Documentation

---
 src/com/gitblit/utils/RpcUtils.java |   46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/src/com/gitblit/utils/RpcUtils.java b/src/com/gitblit/utils/RpcUtils.java
index 2d409a0..faa910b 100644
--- a/src/com/gitblit/utils/RpcUtils.java
+++ b/src/com/gitblit/utils/RpcUtils.java
@@ -28,8 +28,8 @@
 import com.gitblit.models.FederationProposal;
 import com.gitblit.models.FederationSet;
 import com.gitblit.models.RepositoryModel;
-import com.gitblit.models.ServerStatus;
 import com.gitblit.models.ServerSettings;
+import com.gitblit.models.ServerStatus;
 import com.gitblit.models.UserModel;
 import com.google.gson.reflect.TypeToken;
 
@@ -42,6 +42,9 @@
 public class RpcUtils {
 
 	public static final Type NAMES_TYPE = new TypeToken<Collection<String>>() {
+	}.getType();
+
+	public static final Type SETTINGS_TYPE = new TypeToken<Map<String, String>>() {
 	}.getType();
 
 	private static final Type REPOSITORIES_TYPE = new TypeToken<Map<String, RepositoryModel>>() {
@@ -57,6 +60,9 @@
 	}.getType();
 
 	private static final Type SETS_TYPE = new TypeToken<Collection<FederationSet>>() {
+	}.getType();
+
+	private static final Type BRANCHES_TYPE = new TypeToken<Map<String, Collection<String>>>() {
 	}.getType();
 
 	/**
@@ -344,8 +350,26 @@
 	public static ServerSettings getSettings(String serverUrl, String account, char[] password)
 			throws IOException {
 		String url = asLink(serverUrl, RpcRequest.LIST_SETTINGS);
-		ServerSettings settings = JsonUtils.retrieveJson(url, ServerSettings.class, account, password);
+		ServerSettings settings = JsonUtils.retrieveJson(url, ServerSettings.class, account,
+				password);
 		return settings;
+	}
+
+	/**
+	 * Update the settings on the Gitblit server.
+	 * 
+	 * @param settings
+	 *            the settings to update
+	 * @param serverUrl
+	 * @param account
+	 * @param password
+	 * @return true if the action succeeded
+	 * @throws IOException
+	 */
+	public static boolean updateSettings(Map<String, String> settings, String serverUrl,
+			String account, char[] password) throws IOException {
+		return doAction(RpcRequest.EDIT_SETTINGS, null, settings, serverUrl, account, password);
+
 	}
 
 	/**
@@ -365,6 +389,24 @@
 	}
 
 	/**
+	 * Retrieves a map of all branches in the Gitblit server keyed by
+	 * repository.
+	 * 
+	 * @param serverUrl
+	 * @param account
+	 * @param password
+	 * @return
+	 * @throws IOException
+	 */
+	public static Map<String, Collection<String>> getAllBranches(String serverUrl,
+			String account, char[] password) throws IOException {
+		String url = asLink(serverUrl, RpcRequest.LIST_BRANCHES);
+		Map<String, Collection<String>> allReferences = JsonUtils.retrieveJson(url,
+				BRANCHES_TYPE, account, password);
+		return allReferences;
+	}
+
+	/**
 	 * Do the specified administrative action on the Gitblit server.
 	 * 
 	 * @param request

--
Gitblit v1.9.1