James Moger
2011-10-21 fc42a53629eee92eb4155326841a270907640209
src/com/gitblit/utils/RpcUtils.java
@@ -28,6 +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.SettingModel;
import com.gitblit.models.UserModel;
import com.google.gson.reflect.TypeToken;
@@ -55,6 +57,9 @@
   }.getType();
   private static final Type SETS_TYPE = new TypeToken<Collection<FederationSet>>() {
   }.getType();
   private static final Type SETTINGS_TYPE = new TypeToken<Map<String, SettingModel>>() {
   }.getType();
   /**
@@ -294,7 +299,7 @@
      List<FederationModel> list = new ArrayList<FederationModel>(registrations);
      return list;
   }
   /**
    * Retrieves the list of federation proposals.
    * 
@@ -304,15 +309,15 @@
    * @return a collection of FederationProposal objects
    * @throws IOException
    */
   public static List<FederationProposal> getFederationProposals(String serverUrl,
         String account, char[] password) throws IOException {
   public static List<FederationProposal> getFederationProposals(String serverUrl, String account,
         char[] password) throws IOException {
      String url = asLink(serverUrl, RpcRequest.LIST_FEDERATION_PROPOSALS);
      Collection<FederationProposal> proposals = JsonUtils.retrieveJson(url, PROPOSALS_TYPE,
            account, password);
      List<FederationProposal> list = new ArrayList<FederationProposal>(proposals);
      return list;
   }
   /**
    * Retrieves the list of federation repository sets.
    * 
@@ -322,16 +327,48 @@
    * @return a collection of FederationSet objects
    * @throws IOException
    */
   public static List<FederationSet> getFederationSets(String serverUrl,
         String account, char[] password) throws IOException {
   public static List<FederationSet> getFederationSets(String serverUrl, String account,
         char[] password) throws IOException {
      String url = asLink(serverUrl, RpcRequest.LIST_FEDERATION_SETS);
      Collection<FederationSet> sets = JsonUtils.retrieveJson(url, SETS_TYPE,
            account, password);
      Collection<FederationSet> sets = JsonUtils.retrieveJson(url, SETS_TYPE, account, password);
      List<FederationSet> list = new ArrayList<FederationSet>(sets);
      return list;
   }
   /**
    * Retrieves the settings of the Gitblit server.
    *
    * @param serverUrl
    * @param account
    * @param password
    * @return an Map<String, SettingModel> object
    * @throws IOException
    */
   public static Map<String, SettingModel> 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,
            password);
      return settings;
   }
   /**
    * Retrieves the server status object.
    *
    * @param serverUrl
    * @param account
    * @param password
    * @return an ServerStatus object
    * @throws IOException
    */
   public static ServerStatus getStatus(String serverUrl, String account, char[] password)
         throws IOException {
      String url = asLink(serverUrl, RpcRequest.LIST_SERVER_STATUS);
      ServerStatus status = JsonUtils.retrieveJson(url, ServerStatus.class, account, password);
      return status;
   }
   /**
    * Do the specified administrative action on the Gitblit server.
    * 
    * @param request