From d03aff630cbcd49f02d51f08ec59ac3cf7f41d0e Mon Sep 17 00:00:00 2001 From: James Moger Date: Sun, 23 Oct 2011 10:25:39 -0400 Subject: Separate management from administration in rpc servlet. Added skeleton mechanism to update server settings via rpc. --- src/com/gitblit/utils/RpcUtils.java | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/com/gitblit/utils') diff --git a/src/com/gitblit/utils/RpcUtils.java b/src/com/gitblit/utils/RpcUtils.java index 2d409a0a..6572cd9d 100644 --- a/src/com/gitblit/utils/RpcUtils.java +++ b/src/com/gitblit/utils/RpcUtils.java @@ -28,8 +28,9 @@ import com.gitblit.models.FederationModel; 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.SettingModel; import com.gitblit.models.UserModel; import com.google.gson.reflect.TypeToken; @@ -44,6 +45,9 @@ public class RpcUtils { public static final Type NAMES_TYPE = new TypeToken>() { }.getType(); + public static final Type SETTINGS_TYPE = new TypeToken>() { + }.getType(); + private static final Type REPOSITORIES_TYPE = new TypeToken>() { }.getType(); @@ -344,10 +348,28 @@ public class RpcUtils { 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 settings, String serverUrl, + String account, char[] password) throws IOException { + return doAction(RpcRequest.EDIT_SETTINGS, null, settings, serverUrl, account, password); + + } + /** * Retrieves the server status object. * -- cgit v1.2.3