private static Repository manageRepository(String repoURL, String repoUserName, String repoUserPassword,
String cartName, CartridgeInfo cartridgeInfo, String username,
String tenantDomain)
throws Exception {
Repository repository = new Repository();
if (repoURL != null && repoURL.trim().length() > 0) {
log.info("External REPO URL is provided as [" + repoURL +
"]. Therefore not creating a new repo.");
//repository.setRepoName(repoURL.substring(0, repoURL.length()-4)); // remove .git part
repository.setRepoName(repoURL);
repository.setRepoUserName(repoUserName);
repository.setRepoUserPassword(repoUserPassword);
} else {
//log.info("External REPO URL is not provided. Therefore creating a new repo. Adding to Executor");
log.info("External git repo url not provided for tenant "
+ tenantDomain + ", creating an git internal repository");
// for internal repos internal git server username and password is used.
repository.setRepoUserName(System.getProperty(CartridgeConstants.INTERNAL_GIT_USERNAME));
repository.setRepoUserPassword(System.getProperty(CartridgeConstants.INTERNAL_GIT_PASSWORD));
/*repoCreationExecutor.execute(new RepositoryCreator(new RepositoryInfoBean(repoURL,
cartName,
tenantDomain,
repository.getRepoUserName(),
repository.getRepoUserPassword(),
cartridgeInfo.getDeploymentDirs(),
cartridgeInfo)));*/
new RepositoryCreator(new RepositoryInfoBean(repoURL,
cartName,
tenantDomain,
repository.getRepoUserName(),
repository.getRepoUserPassword(),
cartridgeInfo.getDeploymentDirs(),
cartridgeInfo)).createInternalRepository();
String repoName = tenantDomain + "/" + cartName;
repository.setRepoName("https://" + System.getProperty(CartridgeConstants.GIT_HOST_NAME) + ":8443/git/" + repoName);
}
return repository;
}