use of com.gitblit.Constants.FederationToken in project gitblit by gitblit.
the class FederationManager method createFederationProposal.
/**
* Creates a proposal from the token.
*
* @param gitblitUrl
* the url of this Gitblit instance
* @param token
* @return a potential proposal
*/
@Override
public FederationProposal createFederationProposal(String gitblitUrl, String token) {
FederationToken tokenType = FederationToken.REPOSITORIES;
for (FederationToken type : FederationToken.values()) {
if (token.equals(getFederationToken(type))) {
tokenType = type;
break;
}
}
Map<String, RepositoryModel> repositories = getRepositories(gitblitUrl, token);
FederationProposal proposal = new FederationProposal(gitblitUrl, tokenType, token, repositories);
return proposal;
}
use of com.gitblit.Constants.FederationToken in project gitblit by gitblit.
the class ServicesManager method configureFederation.
protected void configureFederation() {
boolean validPassphrase = true;
String passphrase = settings.getString(Keys.federation.passphrase, "");
if (StringUtils.isEmpty(passphrase)) {
logger.info("Federation passphrase is blank! This server can not be PULLED from.");
validPassphrase = false;
}
if (validPassphrase) {
// standard tokens
for (FederationToken tokenType : FederationToken.values()) {
logger.info(MessageFormat.format("Federation {0} token = {1}", tokenType.name(), gitblit.getFederationToken(tokenType)));
}
// federation set tokens
for (String set : settings.getStrings(Keys.federation.sets)) {
logger.info(MessageFormat.format("Federation Set {0} token = {1}", set, gitblit.getFederationToken(set)));
}
}
// Schedule or run the federation executor
List<FederationModel> registrations = gitblit.getFederationRegistrations();
if (registrations.size() > 0) {
FederationPuller executor = new FederationPuller(registrations);
scheduledExecutor.schedule(executor, 1, TimeUnit.MINUTES);
}
}
use of com.gitblit.Constants.FederationToken in project gitblit by gitblit.
the class FederationManager method getFederationSets.
/**
* Returns the list of federation sets.
*
* @return list of federation sets
*/
@Override
public List<FederationSet> getFederationSets(String gitblitUrl) {
List<FederationSet> list = new ArrayList<FederationSet>();
// generate standard tokens
for (FederationToken type : FederationToken.values()) {
FederationSet fset = new FederationSet(type.toString(), type, getFederationToken(type));
fset.repositories = getRepositories(gitblitUrl, fset.token);
list.add(fset);
}
// generate tokens for federation sets
for (String set : settings.getStrings(Keys.federation.sets)) {
FederationSet fset = new FederationSet(set, FederationToken.REPOSITORIES, getFederationToken(set));
fset.repositories = getRepositories(gitblitUrl, fset.token);
list.add(fset);
}
return list;
}
Aggregations