James Moger
2011-10-23 fe326255202dcfac8b0991ca9d28e3cf4bcc4fe6
src/com/gitblit/utils/RpcUtils.java
@@ -28,6 +28,7 @@
import com.gitblit.models.FederationProposal;
import com.gitblit.models.FederationSet;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.ServerSettings;
import com.gitblit.models.ServerStatus;
import com.gitblit.models.SettingModel;
import com.gitblit.models.UserModel;
@@ -44,6 +45,9 @@
   public static final Type NAMES_TYPE = new TypeToken<Collection<String>>() {
   }.getType();
   public static final Type SETTINGS_TYPE = new TypeToken<Collection<SettingModel>>() {
   }.getType();
   private static final Type REPOSITORIES_TYPE = new TypeToken<Map<String, RepositoryModel>>() {
   }.getType();
@@ -57,9 +61,6 @@
   }.getType();
   private static final Type SETS_TYPE = new TypeToken<Collection<FederationSet>>() {
   }.getType();
   private static final Type SETTINGS_TYPE = new TypeToken<Map<String, SettingModel>>() {
   }.getType();
   /**
@@ -341,15 +342,32 @@
    * @param serverUrl
    * @param account
    * @param password
    * @return an Map<String, SettingModel> object
    * @return an Settings object
    * @throws IOException
    */
   public static Map<String, SettingModel> getSettings(String serverUrl, String account,
         char[] password) throws IOException {
   public static ServerSettings getSettings(String serverUrl, String account, char[] password)
         throws IOException {
      String url = asLink(serverUrl, RpcRequest.LIST_SETTINGS);
      Map<String, SettingModel> settings = JsonUtils.retrieveJson(url, SETTINGS_TYPE, account,
      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);
   }
   /**
@@ -363,7 +381,7 @@
    */
   public static ServerStatus getStatus(String serverUrl, String account, char[] password)
         throws IOException {
      String url = asLink(serverUrl, RpcRequest.LIST_SERVER_STATUS);
      String url = asLink(serverUrl, RpcRequest.LIST_STATUS);
      ServerStatus status = JsonUtils.retrieveJson(url, ServerStatus.class, account, password);
      return status;
   }