| | |
| | |
|
| | | /**
|
| | | * Utility methods for rpc calls.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public class RpcUtils {
|
| | |
|
| | |
| | | }.getType();
|
| | |
|
| | | /**
|
| | | * |
| | | *
|
| | | * @param remoteURL
|
| | | * the url of the remote gitblit instance
|
| | | * @param req
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | *
|
| | | * @param remoteURL
|
| | | * the url of the remote gitblit instance
|
| | | * @param req
|
| | |
| | |
|
| | | /**
|
| | | * Returns the version of the RPC protocol on the server.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | | try {
|
| | | protocol = JsonUtils.retrieveJson(url, Integer.class, account, password);
|
| | | } catch (UnknownRequestException e) {
|
| | | // v0.7.0 (protocol 1) did not have this request type |
| | | // v0.7.0 (protocol 1) did not have this request type
|
| | | }
|
| | | return protocol;
|
| | | }
|
| | |
| | | /**
|
| | | * Retrieves a map of the repositories at the remote gitblit instance keyed
|
| | | * by the repository clone url.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | |
|
| | | /**
|
| | | * Tries to pull the gitblit user accounts from the remote gitblit instance.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | | /**
|
| | | * Tries to pull the gitblit team definitions from the remote gitblit
|
| | | * instance.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | |
|
| | | /**
|
| | | * Create a repository on the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | |
|
| | | /**
|
| | | * Send a revised version of the repository model to the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | |
|
| | | /**
|
| | | * Delete a repository from the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | | password);
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Clears the repository cache on the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | | * @return true if the action succeeded
|
| | | * @throws IOException
|
| | | */
|
| | | public static boolean clearRepositoryCache(String serverUrl, String account, |
| | | public static boolean clearRepositoryCache(String serverUrl, String account,
|
| | | char[] password) throws IOException {
|
| | | return doAction(RpcRequest.CLEAR_REPOSITORY_CACHE, null, null, serverUrl, account,
|
| | | password);
|
| | |
| | |
|
| | | /**
|
| | | * Create a user on the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param user
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | |
|
| | | /**
|
| | | * Send a revised version of the user model to the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param user
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | |
|
| | | /**
|
| | | * Deletes a user from the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param user
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | | char[] password) throws IOException {
|
| | | return doAction(RpcRequest.DELETE_USER, null, user, serverUrl, account, password);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Tries to get the specified gitblit user account from the remote gitblit instance.
|
| | | * If the username is null or empty, the current user is returned.
|
| | | * |
| | | *
|
| | | * @param username
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | |
|
| | | /**
|
| | | * Create a team on the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param team
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | |
|
| | | /**
|
| | | * Send a revised version of the team model to the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param team
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | |
|
| | | /**
|
| | | * Deletes a team from the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param team
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | |
|
| | | /**
|
| | | * Retrieves the list of users that can access the specified repository.
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | | Collection<String> list = JsonUtils.retrieveJson(url, NAMES_TYPE, account, password);
|
| | | return new ArrayList<String>(list);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Retrieves the list of user access permissions for the specified repository.
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | | * @return list of User-AccessPermission tuples
|
| | | * @throws IOException
|
| | | */
|
| | | public static List<RegistrantAccessPermission> getRepositoryMemberPermissions(RepositoryModel repository, |
| | | public static List<RegistrantAccessPermission> getRepositoryMemberPermissions(RepositoryModel repository,
|
| | | String serverUrl, String account, char [] password) throws IOException {
|
| | | String url = asLink(serverUrl, RpcRequest.LIST_REPOSITORY_MEMBER_PERMISSIONS, repository.name);
|
| | | Collection<RegistrantAccessPermission> list = JsonUtils.retrieveJson(url, REGISTRANT_PERMISSIONS_TYPE, account, password);
|
| | |
| | |
|
| | | /**
|
| | | * Sets the repository user access permissions
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param permissions
|
| | | * @param serverUrl
|
| | |
| | | return doAction(RpcRequest.SET_REPOSITORY_MEMBER_PERMISSIONS, repository.name, permissions, serverUrl,
|
| | | account, password);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Retrieves the list of teams that can access the specified repository.
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | | Collection<String> list = JsonUtils.retrieveJson(url, NAMES_TYPE, account, password);
|
| | | return new ArrayList<String>(list);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Retrieves the list of team access permissions for the specified repository.
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param serverUrl
|
| | | * @param account
|
| | |
| | | * @return list of Team-AccessPermission tuples
|
| | | * @throws IOException
|
| | | */
|
| | | public static List<RegistrantAccessPermission> getRepositoryTeamPermissions(RepositoryModel repository, |
| | | public static List<RegistrantAccessPermission> getRepositoryTeamPermissions(RepositoryModel repository,
|
| | | String serverUrl, String account, char [] password) throws IOException {
|
| | | String url = asLink(serverUrl, RpcRequest.LIST_REPOSITORY_TEAM_PERMISSIONS, repository.name);
|
| | | Collection<RegistrantAccessPermission> list = JsonUtils.retrieveJson(url, REGISTRANT_PERMISSIONS_TYPE, account, password);
|
| | |
| | |
|
| | | /**
|
| | | * Sets the repository team access permissions
|
| | | * |
| | | *
|
| | | * @param repository
|
| | | * @param permissions
|
| | | * @param serverUrl
|
| | |
| | | return doAction(RpcRequest.SET_REPOSITORY_TEAM_PERMISSIONS, repository.name, permissions, serverUrl,
|
| | | account, password);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Retrieves the list of federation registrations. These are the list of
|
| | | * registrations that this Gitblit instance is pulling from.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | | /**
|
| | | * Retrieves the list of federation result registrations. These are the
|
| | | * results reported back to this Gitblit instance from a federation client.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | |
|
| | | /**
|
| | | * Retrieves the list of federation proposals.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | |
|
| | | /**
|
| | | * Retrieves the list of federation repository sets.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | |
|
| | | /**
|
| | | * Retrieves the settings of the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | |
|
| | | /**
|
| | | * Update the settings on the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param settings
|
| | | * the settings to update
|
| | | * @param serverUrl
|
| | |
| | |
|
| | | /**
|
| | | * Retrieves the server status object.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | | /**
|
| | | * Retrieves a map of local branches in the Gitblit server keyed by
|
| | | * repository.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | |
|
| | | /**
|
| | | * Retrieves a list of available branch feeds in the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param serverUrl
|
| | | * @param account
|
| | | * @param password
|
| | |
| | |
|
| | | /**
|
| | | * Do the specified administrative action on the Gitblit server.
|
| | | * |
| | | *
|
| | | * @param request
|
| | | * @param name
|
| | | * the name of the object (may be null)
|