Class SVNReplicationEditor
java.lang.Object
org.tmatesoft.svn.core.replicator.SVNReplicationEditor
- All Implemented Interfaces:
ISVNDeltaConsumer
,ISVNEditor
The SVNReplicationEditor is an editor implementation used by a
repository replicator as a bridge between an update editor for the source
repository and a commit editor of the target one. This editor is provided
to an update method of a source SVNRepository driver to properly translate
the calls of that driver to calls to a commit editor of the destination SVNRepository
driver.
- Since:
- 1.2
- Version:
- 1.3
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private java.util.Map
private ISVNEditor
private SVNCommitInfo
private java.util.Map
private java.util.Set
private java.util.Stack
private java.util.Map
private long
private SVNRepository
private SVNRepository
private long
-
Constructor Summary
ConstructorsConstructorDescriptionSVNReplicationEditor
(SVNRepository repository, ISVNEditor commitEditor, SVNLogEntry revision) Creates a new replication editor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Aborts the transaction.void
absentDir
(java.lang.String path) Does nothing.void
absentFile
(java.lang.String path) Does nothing.void
addDir
(java.lang.String path, java.lang.String copyFromPath, long copyFromRevision) Adds a new directory under the specifiedpath
to the target repository.void
addFile
(java.lang.String path, java.lang.String copyFromPath, long copyFromRevision) Adds a new file.void
applyTextDelta
(java.lang.String path, java.lang.String baseChecksum) Starts applying text delta.private boolean
areFileContentsEqual
(java.lang.String path1, long rev1, java.lang.String path2, long rev2, SVNProperties props2) void
changeDirProperty
(java.lang.String name, SVNPropertyValue value) Changes a property of the current directory.void
changeFileProperty
(java.lang.String path, java.lang.String name, SVNPropertyValue value) Changes file property.void
closeDir()
Closes the current opened dir.Commits the transaction.void
closeFile
(java.lang.String path, java.lang.String textChecksum) Closes the current opened file.private void
completeDeletion
(java.lang.String dirPath) void
deleteEntry
(java.lang.String path, long revision) Removespath
from the paths to be committed.Returns commit information on the revision committed to the replication destination repository.private SVNLogEntryPath
getFileCopyOrigin
(java.lang.String path) private SVNRepository
void
openDir
(java.lang.String path, long revision) Opens a correspondingpath
in the target repository.void
openFile
(java.lang.String path, long revision) Opens a file.void
openRoot
(long revision) Starts a next replication transaction.void
targetRevision
(long revision) Saves the targetrevision
.java.io.OutputStream
textDeltaChunk
(java.lang.String path, SVNDiffWindow diffWindow) Applies a next chunk of delta.void
textDeltaEnd
(java.lang.String path) Handles text delta end.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
ACCEPT
private static final int ACCEPT- See Also:
-
IGNORE
private static final int IGNORE- See Also:
-
DECIDE
private static final int DECIDE- See Also:
-
myCommitEditor
-
myCopiedPaths
private java.util.Map myCopiedPaths -
myChangedPaths
private java.util.Map myChangedPaths -
myDeletedPaths
private java.util.Set myDeletedPaths -
myRepos
-
myPathsToFileBatons
private java.util.Map myPathsToFileBatons -
myDirsStack
private java.util.Stack myDirsStack -
myPreviousRevision
private long myPreviousRevision -
myTargetRevision
private long myTargetRevision -
myCommitInfo
-
mySourceRepository
-
-
Constructor Details
-
SVNReplicationEditor
public SVNReplicationEditor(SVNRepository repository, ISVNEditor commitEditor, SVNLogEntry revision) Creates a new replication editor.repository
must be created for the root location of the source repository which is to be replicated.- Parameters:
repository
- a source repositorycommitEditor
- a commit editor received from the destination repository driver (which also must be point to the root location of the destination repository)revision
- log information of the revision to be copied
-
-
Method Details
-
targetRevision
Saves the targetrevision
.- Specified by:
targetRevision
in interfaceISVNEditor
- Parameters:
revision
- revision- Throws:
SVNException
-
openRoot
Starts a next replication transaction.- Specified by:
openRoot
in interfaceISVNEditor
- Parameters:
revision
- target revision- Throws:
SVNException
-
deleteEntry
Removespath
from the paths to be committed.- Specified by:
deleteEntry
in interfaceISVNEditor
- Parameters:
path
-revision
-- Throws:
SVNException
- exception withSVNErrorCode.UNKNOWN
error code - if somehow chanded paths fetched from the log of the resource repository did not reflectpath
deletion inrevision
-
absentDir
Does nothing.- Specified by:
absentDir
in interfaceISVNEditor
- Parameters:
path
-- Throws:
SVNException
-
absentFile
Does nothing.- Specified by:
absentFile
in interfaceISVNEditor
- Parameters:
path
-- Throws:
SVNException
-
addDir
public void addDir(java.lang.String path, java.lang.String copyFromPath, long copyFromRevision) throws SVNException Adds a new directory under the specifiedpath
to the target repository.- Specified by:
addDir
in interfaceISVNEditor
- Parameters:
path
- target directory pathcopyFromPath
- not usedcopyFromRevision
- not used- Throws:
SVNException
- exception withSVNErrorCode.UNKNOWN
error code - if somehow chanded paths fetched from the log of the resource repository did not reflectpath
addition
-
openDir
Opens a correspondingpath
in the target repository.- Specified by:
openDir
in interfaceISVNEditor
- Parameters:
path
- target directory path relative to the root of the editrevision
- target directory revision- Throws:
SVNException
-
changeDirProperty
Changes a property of the current directory.- Specified by:
changeDirProperty
in interfaceISVNEditor
- Parameters:
name
-value
-- Throws:
SVNException
- See Also:
-
closeDir
Closes the current opened dir.- Specified by:
closeDir
in interfaceISVNEditor
- Throws:
SVNException
-
addFile
public void addFile(java.lang.String path, java.lang.String copyFromPath, long copyFromRevision) throws SVNException Adds a new file.- Specified by:
addFile
in interfaceISVNEditor
- Parameters:
path
-copyFromPath
-copyFromRevision
-- Throws:
SVNException
-
openFile
Opens a file.- Specified by:
openFile
in interfaceISVNEditor
- Parameters:
path
-revision
-- Throws:
SVNException
-
applyTextDelta
public void applyTextDelta(java.lang.String path, java.lang.String baseChecksum) throws SVNException Starts applying text delta.- Specified by:
applyTextDelta
in interfaceISVNDeltaConsumer
- Parameters:
path
-baseChecksum
-- Throws:
SVNException
-
textDeltaChunk
public java.io.OutputStream textDeltaChunk(java.lang.String path, SVNDiffWindow diffWindow) throws SVNException Applies a next chunk of delta.- Specified by:
textDeltaChunk
in interfaceISVNDeltaConsumer
- Parameters:
path
-diffWindow
-- Returns:
- dummy output stream
- Throws:
SVNException
-
textDeltaEnd
Handles text delta end.- Specified by:
textDeltaEnd
in interfaceISVNDeltaConsumer
- Parameters:
path
-- Throws:
SVNException
-
changeFileProperty
public void changeFileProperty(java.lang.String path, java.lang.String name, SVNPropertyValue value) throws SVNException Changes file property.- Specified by:
changeFileProperty
in interfaceISVNEditor
- Parameters:
path
-name
-value
-- Throws:
SVNException
-
closeFile
Closes the current opened file.- Specified by:
closeFile
in interfaceISVNEditor
- Parameters:
path
-textChecksum
-- Throws:
SVNException
-
closeEdit
Commits the transaction.- Specified by:
closeEdit
in interfaceISVNEditor
- Returns:
- commit info
- Throws:
SVNException
-
abortEdit
Aborts the transaction.- Specified by:
abortEdit
in interfaceISVNEditor
- Throws:
SVNException
-
getCommitInfo
Returns commit information on the revision committed to the replication destination repository.- Returns:
- commit info (revision, author, date)
-
getSourceRepository
- Throws:
SVNException
-
completeDeletion
- Throws:
SVNException
-
getFileCopyOrigin
- Throws:
SVNException
-
areFileContentsEqual
private boolean areFileContentsEqual(java.lang.String path1, long rev1, java.lang.String path2, long rev2, SVNProperties props2) throws SVNException - Throws:
SVNException
-