ModeShape Distribution 3.2.0.Final

org.modeshape.connector.git
Class GitFunction

java.lang.Object
  extended by org.modeshape.connector.git.GitFunction
Direct Known Subclasses:
GitBranches, GitCommitDetails, GitHistory, GitRoot, GitTags, GitTree

public abstract class GitFunction
extends Object


Field Summary
protected  GitConnector connector
           
protected static int DEFAULT_PAGE_SIZE
           
protected static String DELIMITER
           
protected  String name
           
protected  int pageSize
           
protected static String REMOTE_BRANCH_PREFIX
           
protected static Comparator<org.eclipse.jgit.lib.Ref> REVERSE_REF_COMPARATOR
           
protected static String TAG_PREFIX
           
 
Constructor Summary
protected GitFunction(String name, GitConnector connector)
           
 
Method Summary
protected  void addBranchesAsChildren(org.eclipse.jgit.api.Git git, CallSpecification spec, DocumentWriter writer)
          Add the names of the branches as children of the current node.
protected  void addCommitsAsChildren(org.eclipse.jgit.api.Git git, CallSpecification spec, DocumentWriter writer, int pageSize)
          Add the first page of commits in the history names of the tags as children of the current node.
protected  void addCommitsAsPageOfChildren(org.eclipse.jgit.api.Git git, org.eclipse.jgit.lib.Repository repository, CallSpecification spec, PageWriter writer, PageKey pageKey)
          Add an additional page of commits in the history names of the tags as children of the current node.
protected  void addTagsAsChildren(org.eclipse.jgit.api.Git git, CallSpecification spec, DocumentWriter writer)
          Add the names of the tags as children of the current node.
protected  String branchRefForName(String branchName)
          Obtain the name of the branch reference
abstract  Document execute(org.eclipse.jgit.lib.Repository repository, org.eclipse.jgit.api.Git git, CallSpecification spec, DocumentWriter writer, Values values)
           
 String getName()
          Get the name of this function.
 boolean isPaged()
           
protected  boolean isQueryable(CallSpecification callSpec)
           
protected  org.eclipse.jgit.lib.ObjectId resolveBranchOrTagOrCommitId(org.eclipse.jgit.lib.Repository repository, String branchOrTagOrCommitId)
          Resolve the branch name, tag name, or commit ID into the appropriate ObjectId.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DELIMITER

protected static final String DELIMITER
See Also:
Constant Field Values

REMOTE_BRANCH_PREFIX

protected static final String REMOTE_BRANCH_PREFIX
See Also:
Constant Field Values

TAG_PREFIX

protected static final String TAG_PREFIX
See Also:
Constant Field Values

DEFAULT_PAGE_SIZE

protected static final int DEFAULT_PAGE_SIZE
See Also:
Constant Field Values

REVERSE_REF_COMPARATOR

protected static final Comparator<org.eclipse.jgit.lib.Ref> REVERSE_REF_COMPARATOR

name

protected final String name

connector

protected final GitConnector connector

pageSize

protected int pageSize
Constructor Detail

GitFunction

protected GitFunction(String name,
                      GitConnector connector)
Method Detail

getName

public String getName()
Get the name of this function.

Returns:
the name; never null

isPaged

public boolean isPaged()

execute

public abstract Document execute(org.eclipse.jgit.lib.Repository repository,
                                 org.eclipse.jgit.api.Git git,
                                 CallSpecification spec,
                                 DocumentWriter writer,
                                 Values values)
                          throws org.eclipse.jgit.api.errors.GitAPIException,
                                 IOException
Throws:
org.eclipse.jgit.api.errors.GitAPIException
IOException

branchRefForName

protected String branchRefForName(String branchName)
Obtain the name of the branch reference

Parameters:
branchName -
Returns:
the branch ref name

resolveBranchOrTagOrCommitId

protected org.eclipse.jgit.lib.ObjectId resolveBranchOrTagOrCommitId(org.eclipse.jgit.lib.Repository repository,
                                                                     String branchOrTagOrCommitId)
                                                              throws IOException
Resolve the branch name, tag name, or commit ID into the appropriate ObjectId. Note that the branch names are assumed to be from the remote.

Parameters:
repository - the Repository object; may not be null
branchOrTagOrCommitId - the branch name, tag name, or commit ID; may not be null
Returns:
the resolved ObjectId, or null if the supplied string does not resolve to an object ID
Throws:
IOException - if there is a problem reading the Git repository

addBranchesAsChildren

protected void addBranchesAsChildren(org.eclipse.jgit.api.Git git,
                                     CallSpecification spec,
                                     DocumentWriter writer)
                              throws org.eclipse.jgit.api.errors.GitAPIException
Add the names of the branches as children of the current node.

Parameters:
git - the Git object; may not be null
spec - the call specification; may not be null
writer - the document writer for the current node; may not be null
Throws:
org.eclipse.jgit.api.errors.GitAPIException - if there is a problem accessing the Git repository

addTagsAsChildren

protected void addTagsAsChildren(org.eclipse.jgit.api.Git git,
                                 CallSpecification spec,
                                 DocumentWriter writer)
                          throws org.eclipse.jgit.api.errors.GitAPIException
Add the names of the tags as children of the current node.

Parameters:
git - the Git object; may not be null
spec - the call specification; may not be null
writer - the document writer for the current node; may not be null
Throws:
org.eclipse.jgit.api.errors.GitAPIException - if there is a problem accessing the Git repository

addCommitsAsChildren

protected void addCommitsAsChildren(org.eclipse.jgit.api.Git git,
                                    CallSpecification spec,
                                    DocumentWriter writer,
                                    int pageSize)
                             throws org.eclipse.jgit.api.errors.GitAPIException
Add the first page of commits in the history names of the tags as children of the current node.

Parameters:
git - the Git object; may not be null
spec - the call specification; may not be null
writer - the document writer for the current node; may not be null
pageSize - the number of commits to include, and the number of commits that will be in the next page (if there are more commits)
Throws:
org.eclipse.jgit.api.errors.GitAPIException - if there is a problem accessing the Git repository

addCommitsAsPageOfChildren

protected void addCommitsAsPageOfChildren(org.eclipse.jgit.api.Git git,
                                          org.eclipse.jgit.lib.Repository repository,
                                          CallSpecification spec,
                                          PageWriter writer,
                                          PageKey pageKey)
                                   throws org.eclipse.jgit.api.errors.GitAPIException,
                                          IOException
Add an additional page of commits in the history names of the tags as children of the current node.

Parameters:
git - the Git object; may not be null
repository - the Repository object; may not be null
spec - the call specification; may not be null
writer - the page writer for the current node; may not be null
pageKey - the page key for this page; may not be null
Throws:
org.eclipse.jgit.api.errors.GitAPIException - if there is a problem accessing the Git repository
IOException - if there is a problem reading the Git repository

isQueryable

protected boolean isQueryable(CallSpecification callSpec)

toString

public String toString()
Overrides:
toString in class Object

ModeShape Distribution 3.2.0.Final

Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.