public class GitConnector extends ReadOnlyConnector implements Pageable
Connector that accesses the content in a local Git repository that is a clone of a remote repository.
This connector has several properties that must be configured via the RepositoryConfiguration:
directoryPath - The path to the folder that is or contains the .git data
structure is to be accessed by this connector.remoteName - The alias used by the local Git repository for the remote repository. The
default is the "origin". If the value contains commas, the value contains an ordered list of remote aliases that
should be searched; the first one to match an existing remote will be used.queryableBranches - An array with the names of the branches that should be queryable by the
repository. By default, only the master branch is queryable.The connector results in the following structure:
| Path | Description |
|---|---|
/branches/{branchName} |
The list of branches. |
/tags/{tagName} |
The list of tags. |
/commits/{branchOrTagNameOrCommit}/{objectId} |
The history of commits on the branch, tag or object ID name "{branchOrTagNameOrCommit}", where "
{objectId}" is the object ID of the commit. |
/commit/{branchOrTagNameOrCommit} |
The information about a particular branch, tag or commit "{branchOrTagNameOrCommit}". |
/tree/{branchOrTagOrObjectId}/{filesAndFolders}/... |
The structure of the directories and files in the specified branch, tag or commit "{branchOrTagNameOrCommit}".
|
Connector.ExtraProperties| Constructor and Description |
|---|
GitConnector() |
| Modifier and Type | Method and Description |
|---|---|
ExternalBinaryValue |
getBinaryValue(String id)
Returns a binary value which is connector specific and which is never stored by ModeShape.
|
Document |
getChildReference(String parentKey,
String childKey)
Returns a document representing a single child reference from the supplied parent to the supplied child.
|
Document |
getChildren(PageKey pageKey)
Returns a document which represents the document of a parent node to which an optiona page of children has been added.
|
Document |
getDocumentById(String id)
Returns a
Document instance representing the document with a given id. |
String |
getDocumentId(String path)
Returns the id of an external node located at the given external path within the connector's exposed tree of content.
|
Collection<String> |
getDocumentPathsById(String id)
Return the path(s) of the external node with the given identifier.
|
protected List<String> |
getQueryableBranches() |
boolean |
hasDocument(String id)
Checks if a document with the given id exists in the end-source.
|
protected boolean |
includeMimeType() |
void |
initialize(NamespaceRegistry registry,
NodeTypeManager nodeTypeManager)
Initialize the connector.
|
protected DocumentWriter |
newDocumentWriter(String id) |
protected String |
remoteName() |
protected List<String> |
remoteNames() |
void |
shutdown()
Shutdown the connector by releasing all resources.
|
isReadonly, newDocumentId, removeDocument, storeDocument, updateDocumentcheckFieldNotNull, extraPropertiesFor, extraPropertiesStore, factories, getCacheTtlSeconds, getContext, getEnvironment, getLogger, getMimeTypeDetector, getRepositoryName, getSourceName, getTransactionManager, isQueryable, log, nameFrom, nameFrom, nameFrom, newChildReference, newConnectorChangedSet, newDocument, newPageDocument, pathFactory, pathFrom, pathFrom, propertyFactory, readDocument, setExtraPropertiesStore, translator, writeDocumentpublic void initialize(NamespaceRegistry registry, NodeTypeManager nodeTypeManager) throws RepositoryException, IOException
ConnectorConnector.context,
Connector.logger, Connector.name, and Connector.repositoryName plus any fields that match configuration properties for the
connector.
By default this method does nothing, so it should be overridden by implementations to do a one-time initialization of any
internal components. For example, connectors can use the supplied registry and nodeTypeManager
objects to register custom namesapces and node types required by the external content.
This is an excellent place for connector to validate the connector-specific fields set by ModeShape via reflection during instantiation.
initialize in class Connectorregistry - the namespace registry that can be used to register custom namespaces; never nullnodeTypeManager - the node type manager that can be used to register custom node types; never nullRepositoryException - if operations on the NamespaceRegistry or NodeTypeManager failIOException - if any stream based operations fail (like importing cnd files)protected DocumentWriter newDocumentWriter(String id)
protected boolean includeMimeType()
public void shutdown()
Connectorpublic Document getDocumentById(String id)
ConnectorDocument instance representing the document with a given id. The document should have a "proper"
structure for it to be usable by ModeShape.getDocumentById in class Connectorid - a non-null stringDocument instance or nullpublic Document getChildren(PageKey pageKey)
PageablePageWriter.addPage(String, String, long, long) should be used to add a
new page of children.getChildren in interface PageablepageKey - a non-null PageKey instance, which offers information about the page that should be
retrieved.non-null document representing the parent document.public Document getChildReference(String parentKey, String childKey)
Connector
This method should be implemented and will be called if and only if a connector uses paging and specifies
an unknown number of children in the
PageWriter.addPage(String, int, long, long) or PageWriter.addPage(String, String, long, long) methods.
getChildReference in class ConnectorparentKey - the key for the parentchildKey - the key for the childpublic String getDocumentId(String path)
ConnectorgetDocumentId in class Connectorpath - a non-null string representing an external path, or "/" for the top-level node exposed by the
connectornullpublic Collection<String> getDocumentPathsById(String id)
ConnectorgetDocumentPathsById in class Connectorid - a non-null stringpublic boolean hasDocument(String id)
ConnectorhasDocument in class Connectorid - a non-null string.true if such a document exists, false otherwise.public ExternalBinaryValue getBinaryValue(String id)
ConnectorExternalBinaryValue, either UrlBinaryValue or
a custom subclass with connector-specific information.
Normally, the Connector.getDocumentById(String) method implementation will set binary values on properties of nodes, which
should create the same ExternalBinaryValue subclass that is returned by this method. The
ExternalBinaryValue.getId() value from that instance will be passed into this method.
getBinaryValue in class Connectorid - a String representing the identifier of the external binary which should have connector-specific meaning.
This identifier need not be the SHA-1 hash of the content.null if there is no such value with the given id.protected final String remoteName()
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.