|
ModeShape Distribution 3.1.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.jcr.federation.spi.Connector
org.modeshape.jcr.federation.spi.ReadOnlyConnector
org.modeshape.connector.git.GitConnector
public class GitConnector
A read-only 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}".
|
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.modeshape.jcr.federation.spi.Connector |
|---|
Connector.ExtraProperties |
| Constructor Summary | |
|---|---|
GitConnector()
|
|
| Method Summary | |
|---|---|
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 a page of children. |
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 path. |
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()
|
void |
shutdown()
Shutdown the connector by releasing all resources. |
| Methods inherited from class org.modeshape.jcr.federation.spi.ReadOnlyConnector |
|---|
removeDocument, storeDocument, updateDocument |
| Methods inherited from class org.modeshape.jcr.federation.spi.Connector |
|---|
checkFieldNotNull, extraPropertiesFor, extraPropertiesStore, factories, getCacheTtlSeconds, getContext, getLogger, getMimeTypeDetector, getRepositoryName, getSourceName, getTransactionManager, isQueryable, nameFrom, nameFrom, nameFrom, newChildReference, newDocument, newPageDocument, propertyFactory, readDocument, setExtraPropertiesStore, translator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GitConnector()
| Method Detail |
|---|
public 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 null
RepositoryException - if operations on the NamespaceRegistry or NodeTypeManager fail
IOException - if any stream based operations fail (like importing cnd files)protected DocumentWriter newDocumentWriter(String id)
protected boolean includeMimeType()
public void shutdown()
Connector
shutdown in class 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 string
Document 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 page document or null indicating that such a page doesn't exist
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 child
public String getDocumentId(String path)
Connector
getDocumentId in class Connectorpath - a non-null string representing an exeternal path.
nullpublic boolean hasDocument(String id)
Connector
hasDocument in class Connectorid - a non-null string.
true if such a document exists, false otherwise.public ExternalBinaryValue getBinaryValue(String id)
ConnectorExternalBinaryValue
getBinaryValue in class Connectorid - a String representing the id of the external binary which should have connector-specific meaning.
null if there is no such value with the given id.protected final String remoteName()
protected List<String> getQueryableBranches()
|
ModeShape Distribution 3.1.0.Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||