java.lang.Object
org.wso2.carbon.deployment.synchronizer.git.util.GitUtilities

public class GitUtilities extends Object
Utility methods specific for Git
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    addRemote(org.eclipse.jgit.lib.Repository repository, String remoteUrl)
    Adds the remote repository at remoteUrl to the given local repository
    static org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider
    createCredentialsProvider(org.wso2.carbon.deployment.synchronizer.RepositoryManager repositoryManager, int tenantId)
    Creates and return a UsernamePasswordCredentialsProvider instance for a tenant
    static void
    InitGitRepository(File gitRepoDir)
    Initialize local git repository
    static boolean
    isValidGitRepo(org.eclipse.jgit.lib.Repository repository)
    Checks if an existing local repository is a valid git repository

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GitUtilities

      public GitUtilities()
  • Method Details

    • isValidGitRepo

      public static boolean isValidGitRepo(org.eclipse.jgit.lib.Repository repository)
      Checks if an existing local repository is a valid git repository
      Parameters:
      repository - Repository instance
      Returns:
      true if a valid git repo, else false
    • createCredentialsProvider

      public static org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider createCredentialsProvider(org.wso2.carbon.deployment.synchronizer.RepositoryManager repositoryManager, int tenantId)
      Creates and return a UsernamePasswordCredentialsProvider instance for a tenant
      Parameters:
      repositoryManager - RepositoryManager instance
      tenantId - tenant Id
      Returns:
      UsernamePasswordCredentialsProvider instance or null if username/password is not valid
    • InitGitRepository

      public static void InitGitRepository(File gitRepoDir)
      Initialize local git repository
      Parameters:
      gitRepoDir - directory in the local file system
    • addRemote

      public static boolean addRemote(org.eclipse.jgit.lib.Repository repository, String remoteUrl)
      Adds the remote repository at remoteUrl to the given local repository
      Parameters:
      repository - Repository instance representing local repo
      remoteUrl - remote repository url
      Returns:
      true if remote successfully added, else false