org.netbeans.libs.git/1 0.8.0

org.netbeans.libs.git
Class GitClientFactory

java.lang.Object
  extended by org.netbeans.libs.git.GitClientFactory

public final class GitClientFactory
extends Object

Factory class used to create git clients bound to a specific local repository.

Clients are bound to a local repository. If the repository does not exist yet, you still have to provide a local file which indicates where the repository would be created when GitClient.init(org.netbeans.libs.git.progress.ProgressMonitor) was called.

Internally the factory keeps a pool of git repositories and caches data needed to operate with the repository and to return a client as fast as possible. The repository data are cached under a weak reference to the instance of the local file passed in the getClient(java.io.File) method.
It means that subsequent call to the getClient method with the same instance of the file will not have to load all data needed to reconstruct the repository in memory. It is up to a caller's responsibility to hold a strong reference to the file.


Method Summary
 GitClient getClient(File repositoryLocation)
          Returns a git client bound to a given local git repository.
static GitClientFactory getInstance()
          Returns the instance of GitClientFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static GitClientFactory getInstance()
Returns the instance of GitClientFactory.

Returns:
instance of GitClientFactory

getClient

public GitClient getClient(File repositoryLocation)
                    throws GitException
Returns a git client bound to a given local git repository. The repository may or may not exist yet, however most git commands work only on an existing repository.

Parameters:
repositoryLocation - repository root location, the file may or may not exist.
Returns:
an instance of a git client
Throws:
GitException - when an error occurs while loading repository data from disk.

org.netbeans.libs.git/1 0.8.0

Built on February 9 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.