JBoss Community Archive (Read Only)

ModeShape 3

Git connector

This read-only connector exposes the branches, tags, and commits in a local Git repository as nodes within a repository. The structure is pre-defined by the connector so that the branches, tags, commits, and their files and folders are all accessible via navigation, via identifiers, or via query (if configured).

The connector classname is "org.modeshape.connector.git.GitConnector", and there are several attributes that should be configured on each external source:

Attribute Name



The path to the folder that is or contains the .git data structure is to be accessed by this connector. This is required.


A boolean flag denoting whether the MIME types for the files should be determined and included as a property on the node. This is 'false' by default.


The alias used by the local Git repository for the remote repository. The default is "origin", which is common in Git repositories. If the value contains commas, the value contains an ordered list of remote aliases that should be accessed; the first one to match an existing remote will be used. The remote names are used to know which branches should be exposed: if at least one remote name is given, then only the branches in the remote(s) will be exposed; if no remotes are given, then all local branches will be exposed.


An array with the names of the branches that should be queryable by the repository. By default, only the "master" branch is queryable. Set this to an empty array if no branches are to be queryable.


Optional property that specifies the default maximum number of seconds (i.e., time to live) that a node returned by this connector should be cached in the workspace cache before being expired. By default, the connector will not set a special value, and the repository will determine how long the node is cached in the workspace cache.

Here is a sample configuration that projects the Git repository located at "/home/jsmith/git/MyRepo" on the local file system into the repository under the "/git/MyRepo" node, which will have a primary type of "git:root". The "master" and "2.x" branches will be included in the ModeShape indexes when the content is reindexed, and MIME types will be included on all git:resource nodes (that is, the "jcr:content" child of the "git:file" nodes). The list of branches and tags will include those on the "upstream" and "origin" remotes.

    "externalSources" : {
        "local-git-repo" : {
            "classname" : "org.modeshape.connector.git.GitConnector",
            "directoryPath" : "/home/jsmit/git/MyRepo/",
            "remoteName" : "upstream,origin",
            "includeMimeType" : true,
            "queryableBranches" : ["master","2.x"],
            "projections" : \[ "/git/MyRepo" \]

And here is a description of the repository structure:




The list of branches.


The list of tags.


The history of commits on the branch, tag or object ID name "{branchOrTagNameOrCommit}", where "{objectId}" is the object ID of the commit.


The information about a particular branch, tag or commit "{branchOrTagNameOrCommit}".


The structure of the directories and files in the specified branch, tag or commit "{branchOrTagNameOrCommit}".

The node types used by the connector are specified here. Some of the more important node types include:

Node Type



A mixin that defines the git:objectId (SHA-1 hash), git:author, git:committer, git:committed (date), and git:title properties that appear on all "committed" nodes.


The primary node type for a node representing a file in a Git repository. Extends both nt:file and git:committed.


The primary node type for a node representing a folder in a Git repository. Extends both nt:folder and git:committed.


The primary node type for a node representing the "jcr:content" child of git:file nodes, where content-related information is placed. Extends both nt:resource and git:committed.


The primary node type for a node representing a Git branch.


The primary node type for a node representing a Git tag.


The primary node type for a node representing a Git commit.


The primary node type for the node that contains the list of git:branch nodes.


The primary node type for the node that contains the list of git:tag nodes.


The primary node type for the node that contains a list of git:commit nodes.


The primary node type for the top-level node of the repository.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:06:56 UTC, last content change 2013-07-05 15:51:39 UTC.