}
private Repository createRepository(String cartridgeName, String tenantDomain, String userName, String password)
throws Exception {
Repository repository = new Repository();
String repoName = tenantDomain + "/" + cartridgeName;
try {
log.info("Creating internal repo ["+repoName+"] ");
RepositoryModel model = new RepositoryModel();
model.name = repoName;
model.accessRestriction = Constants.AccessRestrictionType.VIEW;
char[] passwordArr = password.toCharArray();
boolean isSuccess =
RpcUtils.createRepository(model,
System.getProperty(CartridgeConstants.INTERNAL_GIT_URL),
userName, passwordArr);
if (!isSuccess) {
throw new Exception("Exception is occurred when creating an internal git repo. ");
}
} catch (Exception e) {
log.error(" Exception is occurred when creating an internal git repo. Reason :" +
e.getMessage());
handleException(e.getMessage(), e);
}
repository.setUrl(System.getProperty(CartridgeConstants.INTERNAL_GIT_URL)+repoName);
repository.setUserName(userName);
repository.setPassword(password);
log.info("Repository is created. : " + repository);
return repository;
}