summaryrefslogtreecommitdiffstats
path: root/src/com/ibm/ServerWizard2/utility/Github.java
blob: 6eef91b681ede79692409941b8f7316b29694f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.ibm.ServerWizard2.utility;

import java.io.File;
import java.util.Vector;

public class Github { 
	private Vector<GithubRepository> repositories = new Vector<GithubRepository>();
	private String localPath;

	public Github(String path) {
		this.localPath = path;
		File f = new File(path);
		if (!f.exists()) {
			f.mkdirs();
		}
	}
	public String getLocation() {
		return this.localPath;
	}
	public boolean isRepository(GithubRepository repo) {
		return repositories.contains(repo);
	}
	
	public Vector<GithubRepository> getRepositories() {
		return repositories;
	}
	
	public String getRepositoriesStr() {
		String repos[] = new String[this.repositories.size()];
		for (int i = 0; i < this.repositories.size(); i++) {
			repos[i] = this.repositories.get(i).getRemoteUrl();
		}
		return String.join(",", repos);
	}
	
	public String getPasswordStr() {
		String repos[] = new String[this.repositories.size()];
		for (int i = 0; i < this.repositories.size(); i++) {
			repos[i] = this.repositories.get(i).needsPasswordStr();
		}
		return String.join(",", repos);
	}
}
OpenPOWER on IntegriCloud