public abstract class AbstractRepoTransport extends Object implements RepoTransport
| Constructor and Description |
|---|
AbstractRepoTransport() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected String |
determinePathPrefix() |
protected abstract URL |
determineRemoteRootWithoutPathPrefix() |
protected void |
finalize() |
UUID |
getClientRepositoryId()
Gets the client repository's unique identifier.
|
UUID |
getClientRepositoryIdOrFail() |
String |
getPathPrefix()
Prefix for every path (as used in
RepoTransport.delete(String) for example). |
URL |
getRemoteRoot()
Gets the remote repository's root URL, maybe including a path-prefix.
|
URL |
getRemoteRootWithoutPathPrefix()
Gets the remote repository's root URL without the path-prefix.
|
RepoTransportFactory |
getRepoTransportFactory()
Gets the factory which created this instance.
|
protected boolean |
isPathUnderPathPrefix(String path) |
String |
prefixPath(String path)
Prepend the
pathPrefix to the given path. |
void |
setClientRepositoryId(UUID clientRepositoryId)
Sets the client's repository identifier.
|
void |
setRemoteRoot(URL remoteRoot)
Sets the remote repository's root URL.
|
void |
setRepoTransportFactory(RepoTransportFactory repoTransportFactory)
Sets the factory which created this instance.
|
String |
unprefixPath(String path)
Cut the
pathPrefix from the given path. |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbeginPutFile, copy, delete, endPutFile, endSyncFromRepository, endSyncToRepository, getChangeSetDto, getClientRepositoryDto, getFileData, getPublicKey, getRepoFileDto, getRepositoryDto, getRepositoryId, getVersionInfoDto, makeDirectory, makeSymlink, move, prepareForChangeSetDto, putFileData, putParentConfigPropSetDto, requestRepoConnectionpublic AbstractRepoTransport()
public RepoTransportFactory getRepoTransportFactory()
RepoTransportgetRepoTransportFactory in interface RepoTransportnull, if properly initialised.RepoTransport.setRepoTransportFactory(RepoTransportFactory)public void setRepoTransportFactory(RepoTransportFactory repoTransportFactory)
RepoTransportsetRepoTransportFactory in interface RepoTransportrepoTransportFactory - the factory which created this instance. Must not be null.RepoTransport.getRepoTransportFactory()public URL getRemoteRoot()
RepoTransportThis is thus the remote repository's root URL as used to synchronise a certain local repository. The word "remote" should not be misunderstood as actually on another computer. It just means behind this transport abstraction.
In contrast to the remoteRootWithoutPathPrefix, this is
the connection point for the synchronisation, which might be a sub-directory, i.e. not the native
root of the connected repository.
getRemoteRoot in interface RepoTransportnull, if properly initialised.RepoTransport.setRemoteRoot(URL)public void setRemoteRoot(URL remoteRoot)
RepoTransport
This URL is the point where the client-repository is connected
to the repository managed by this RepoTransport.
You should never directly invoke this method! It is automatically called when creating a
RepoTransport instance via the RepoTransportFactory.
Invoking this method twice with different remoteRoot values is not allowed. The remoteRoot
cannot be changed after it was once set.
setRemoteRoot in interface RepoTransportremoteRoot - the remote repository's root URL. It may be null, but this
RepoTransport is only usable, after this method was invoked with a non-null value.RepoTransport.getRemoteRoot()public UUID getClientRepositoryIdOrFail()
public UUID getClientRepositoryId()
RepoTransport
The word "client" does not necessarily mean a remote JVM. It merely means the API client accessing
this RepoTransport API.
This property might be null. If it is not set, only operations which do not require
repo-to-repo-authentication can be used.
getClientRepositoryId in interface RepoTransportnull.RepoTransport.setClientRepositoryId(UUID)public void setClientRepositoryId(UUID clientRepositoryId)
RepoTransportsetClientRepositoryId in interface RepoTransportclientRepositoryId - the client's repository identifier. May be null.RepoTransport.getClientRepositoryId()public URL getRemoteRootWithoutPathPrefix()
RepoTransportIn other words, this is the repository's native root, even if the connection is established to a sub-directory.
getRemoteRootWithoutPathPrefix in interface RepoTransportnull, if properly initialised.protected abstract URL determineRemoteRootWithoutPathPrefix()
public String getPathPrefix()
RepoTransportRepoTransport.delete(String) for example).
It is possible to connect to a repository at a sub-directory, i.e. not the repo's root. If this
RepoTransport is connected to the repo's root, this pathPrefix is an empty string.
But if this RepoTransport is connected to a sub-directory, this sub-directory will be the
pathPrefix.
For example, if the remoteRoot is
"https://some.host/some/repo/Private+pictures/Wedding+%26+honeymoon" and the
remoteRootWithoutPathPrefix is
"https://some.host/some/repo",
then this pathPrefix will be "/Private pictures/Wedding & honeymoon".
As shown in this example, the pathPrefix is - just like every other path - not encoded
in any way! The separator for the path-segments inside this prefix is "/" on all operating systems.
The RepoTransport implementations use this prefix to calculate back and forth between the
path relative to the connected remoteRoot and the complete path used in the repository.
getPathPrefix in interface RepoTransportprotected String determinePathPrefix()
public String prefixPath(String path)
RepoTransportpathPrefix to the given path.prefixPath in interface RepoTransportpath - the path to be prepended. Must not be null.pathPrefix and the given
path. Never null.RepoTransport.unprefixPath(String),
RepoTransport.getPathPrefix()public String unprefixPath(String path)
RepoTransportpathPrefix from the given path.unprefixPath in interface RepoTransportpath - the path to be shortened. Must not be null. Of course, this path
must start with pathPrefix.pathPrefix. Never
null.RepoTransport.prefixPath(String),
RepoTransport.getPathPrefix()protected boolean isPathUnderPathPrefix(String path)
public void close()
close in interface RepoTransportclose in interface AutoCloseableCopyright © 2013–2017. All rights reserved.