diff options
author | James Moger <james.moger@gitblit.com> | 2013-05-21 17:36:51 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-05-21 17:36:51 -0400 |
commit | 416614cdc35aff21281df7d1f359cd9f65d5af63 (patch) | |
tree | a58fbbf65fa13541e9e94f47776e367302b66323 /src/main/java/com/gitblit/models/GitClientApplication.java | |
parent | 80d281ea19de08c6e10d2c502a109ecdc72736f4 (diff) | |
download | gitblit-416614cdc35aff21281df7d1f359cd9f65d5af63.tar.gz gitblit-416614cdc35aff21281df7d1f359cd9f65d5af63.zip |
Allow clients to define supported transports
Diffstat (limited to 'src/main/java/com/gitblit/models/GitClientApplication.java')
-rw-r--r-- | src/main/java/com/gitblit/models/GitClientApplication.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/models/GitClientApplication.java b/src/main/java/com/gitblit/models/GitClientApplication.java index 8225da4a..eb47eb1f 100644 --- a/src/main/java/com/gitblit/models/GitClientApplication.java +++ b/src/main/java/com/gitblit/models/GitClientApplication.java @@ -39,6 +39,7 @@ public class GitClientApplication implements Serializable { public String cloneUrl;
public String command;
public String productUrl;
+ public String [] transports;
public String[] platforms;
public AccessPermission minimumPermission;
public boolean isActive;
@@ -60,6 +61,25 @@ public class GitClientApplication implements Serializable { return false;
}
+ public boolean supportsTransport(String transportOrUrl) {
+ if (ArrayUtils.isEmpty(transports)) {
+ return true;
+ }
+
+ String scheme = transportOrUrl;
+ if (transportOrUrl.indexOf(':') > -1) {
+ // strip scheme
+ scheme = transportOrUrl.substring(0, transportOrUrl.indexOf(':'));
+ }
+
+ for (String transport : transports) {
+ if (transport.equalsIgnoreCase(scheme)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Override
public String toString() {
return StringUtils.isEmpty(title) ? name : title;
|