diff options
Diffstat (limited to 'src/com/gitblit/utils')
-rw-r--r-- | src/com/gitblit/utils/FederationUtils.java | 16 | ||||
-rw-r--r-- | src/com/gitblit/utils/JsonUtils.java | 13 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/com/gitblit/utils/FederationUtils.java b/src/com/gitblit/utils/FederationUtils.java index 8207962a..4d6060dd 100644 --- a/src/com/gitblit/utils/FederationUtils.java +++ b/src/com/gitblit/utils/FederationUtils.java @@ -285,7 +285,8 @@ public class FederationUtils { }
/**
- * Tries to pull the gitblit team definitions from the remote gitblit instance.
+ * Tries to pull the gitblit team definitions from the remote gitblit
+ * instance.
*
* @param registration
* @return a collection of TeamModel objects
@@ -313,6 +314,19 @@ public class FederationUtils { }
/**
+ * Tries to pull the referenced scripts from the remote gitblit instance.
+ *
+ * @param registration
+ * @return a map of the remote gitblit scripts by script name
+ * @throws Exception
+ */
+ public static Map<String, String> getScripts(FederationModel registration) throws Exception {
+ String url = asLink(registration.url, registration.token, FederationRequest.PULL_SCRIPTS);
+ Map<String, String> scripts = JsonUtils.retrieveJson(url, SETTINGS_TYPE);
+ return scripts;
+ }
+
+ /**
* Send an status acknowledgment to the remote Gitblit server.
*
* @param identification
diff --git a/src/com/gitblit/utils/JsonUtils.java b/src/com/gitblit/utils/JsonUtils.java index 3cb43eb1..da9c99d2 100644 --- a/src/com/gitblit/utils/JsonUtils.java +++ b/src/com/gitblit/utils/JsonUtils.java @@ -108,6 +108,19 @@ public class JsonUtils { UnauthorizedException {
return retrieveJson(url, type, null, null);
}
+
+ /**
+ * Reads a gson object from the specified url.
+ *
+ * @param url
+ * @param type
+ * @return the deserialized object
+ * @throws {@link IOException}
+ */
+ public static <X> X retrieveJson(String url, Class<? extends X> clazz) throws IOException,
+ UnauthorizedException {
+ return retrieveJson(url, clazz, null, null);
+ }
/**
* Reads a gson object from the specified url.
|