|
ModeShape Distribution 3.2.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 |
---|
isReadonly, newDocumentId, 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
Connector
Connector.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 Connector
registry
- 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 Connector
public Document getDocumentById(String id)
Connector
Document
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 Connector
id
- a non-null
string
Document
instance or null
public Document getChildren(PageKey pageKey)
Pageable
PageWriter.addPage(String, String, long, long)
should be used to add a new page of children.
getChildren
in interface Pageable
pageKey
- 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 existpublic 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 Connector
parentKey
- the key for the parentchildKey
- the key for the child
public String getDocumentId(String path)
Connector
getDocumentId
in class Connector
path
- a non-null
string representing an exeternal path.
null
public boolean hasDocument(String id)
Connector
hasDocument
in class Connector
id
- a non-null
string.
true
if such a document exists, false
otherwise.public ExternalBinaryValue getBinaryValue(String id)
Connector
ExternalBinaryValue
, 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 Connector
id
- 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()
protected List<String> getQueryableBranches()
|
ModeShape Distribution 3.2.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |