Package org.tmatesoft.svn.core.replicator

# Class SVNReplicationEditor

java.lang.Object
org.tmatesoft.svn.core.replicator.SVNReplicationEditor

All Implemented Interfaces:
  `ISVNDeltaConsumer`, `ISVNEditor`

public class SVNReplicationEditor extends Object implements 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
Author:
  TMate Software Ltd.
See Also:
  - `SVNRepository`

## Constructor Summary

Constructors
Constructor
Description
`SVNReplicationEditor(SVNRepository repository, ISVNEditor commitEditor, SVNLogEntry revision)`
Creates a new replication editor.

## Method Summary

Modifier and Type
Method
Description
`void`
`abortEdit()`
Aborts the transaction.
`void`
`absentDir(String path)`
Does nothing.
`void`
`absentFile(String path)`
Does nothing.
`void`
`addDir(String path, String copyFromPath, long copyFromRevision)`
Adds a new directory under the specified `path` to the target repository.
`void`
`addFile(String path, String copyFromPath, long copyFromRevision)`
Adds a new file.
`void`
`applyTextDelta(String path, String baseChecksum)`
Starts applying text delta.
`void`
`changeDirProperty(String name, SVNPropertyValue value)`
Changes a property of the current directory.
`void`
`changeFileProperty(String path, String name, SVNPropertyValue value)`
Changes file property.
`void`
`closeDir()`
Closes the current opened dir.
`SVNCommitInfo`
`closeEdit()`
Commits the transaction.
`void`
`closeFile(String path, String textChecksum)`
Closes the current opened file.
`void`
`deleteEntry(String path, long revision)`
Removes `path` from the paths to be committed.
`SVNCommitInfo`
`getCommitInfo()`
Returns commit information on the revision committed to the replication destination repository.
`void`
`openDir(String path, long revision)`
Opens a corresponding `path` in the target repository.
`void`
`openFile(String path, long revision)`
Opens a file.
`void`
`openRoot(long revision)`
Starts a next replication transaction.
`void`
`targetRevision(long revision)`
Saves the target `revision`.
`OutputStream`
`textDeltaChunk(String path, SVNDiffWindow diffWindow)`
Applies a next chunk of delta.
`void`
`textDeltaEnd(String path)`
Handles text delta end.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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 repository
  `commitEditor` - 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

public void targetRevision(long revision) throws SVNException
Saves the target `revision`.

Specified by:
  `targetRevision` in interface `ISVNEditor`
Parameters:
  `revision` - revision
Throws:
  `SVNException`

### openRoot

public void openRoot(long revision) throws SVNException
Starts a next replication transaction.

Specified by:
  `openRoot` in interface `ISVNEditor`
Parameters:
  `revision` - target revision
Throws:
  `SVNException`

### deleteEntry

public void deleteEntry(String path, long revision) throws SVNException
Removes `path` from the paths to be committed.

Specified by:
  `deleteEntry` in interface `ISVNEditor`
Parameters:
  `path` -
  `revision` -
Throws:
  `SVNException` - exception with `SVNErrorCode.UNKNOWN` error code - if somehow chanded paths fetched from the log of the resource repository did not reflect `path` deletion in `revision`

### absentDir

public void absentDir(String path) throws SVNException
Does nothing.

Specified by:
  `absentDir` in interface `ISVNEditor`
Parameters:
  `path` -
Throws:
  `SVNException`

### absentFile

public void absentFile(String path) throws SVNException
Does nothing.

Specified by:
  `absentFile` in interface `ISVNEditor`
Parameters:
  `path` -
Throws:
  `SVNException`

### addDir

public void addDir(String path, String copyFromPath, long copyFromRevision) throws SVNException
Adds a new directory under the specified `path` to the target repository.

Specified by:
  `addDir` in interface `ISVNEditor`
Parameters:
  `path` - target directory path
  `copyFromPath` - not used
  `copyFromRevision` - not used
Throws:
  `SVNException` - exception with `SVNErrorCode.UNKNOWN` error code - if somehow chanded paths fetched from the log of the resource repository did not reflect `path` addition

### openDir

public void openDir(String path, long revision) throws SVNException
Opens a corresponding `path` in the target repository.

Specified by:
  `openDir` in interface `ISVNEditor`
Parameters:
  `path` - target directory path relative to the root of the edit
  `revision` - target directory revision
Throws:
  `SVNException`

### changeDirProperty

public void changeDirProperty(String name, SVNPropertyValue value) throws SVNException
Changes a property of the current directory.

Specified by:
  `changeDirProperty` in interface `ISVNEditor`
Parameters:
  `name` -
  `value` -
Throws:
  `SVNException`
See Also:
  - `ISVNEditor.openDir(String, long)`

### closeDir

public void closeDir() throws SVNException
Closes the current opened dir.

Specified by:
  `closeDir` in interface `ISVNEditor`
Throws:
  `SVNException`

### addFile

public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException
Adds a new file.

Specified by:
  `addFile` in interface `ISVNEditor`
Parameters:
  `path` -
  `copyFromPath` -
  `copyFromRevision` -
Throws:
  `SVNException`

### openFile

public void openFile(String path, long revision) throws SVNException
Opens a file.

Specified by:
  `openFile` in interface `ISVNEditor`
Parameters:
  `path` -
  `revision` -
Throws:
  `SVNException`

### applyTextDelta

public void applyTextDelta(String path, String baseChecksum) throws SVNException
Starts applying text delta.

Specified by:
  `applyTextDelta` in interface `ISVNDeltaConsumer`
Parameters:
  `path` -
  `baseChecksum` -
Throws:
  `SVNException`

### textDeltaChunk

public OutputStream textDeltaChunk(String path, SVNDiffWindow diffWindow) throws SVNException
Applies a next chunk of delta.

Specified by:
  `textDeltaChunk` in interface `ISVNDeltaConsumer`
Parameters:
  `path` -
  `diffWindow` -
Returns:
  dummy output stream
Throws:
  `SVNException`

### textDeltaEnd

public void textDeltaEnd(String path) throws SVNException
Handles text delta end.

Specified by:
  `textDeltaEnd` in interface `ISVNDeltaConsumer`
Parameters:
  `path` -
Throws:
  `SVNException`

### changeFileProperty

public void changeFileProperty(String path, String name, SVNPropertyValue value) throws SVNException
Changes file property.

Specified by:
  `changeFileProperty` in interface `ISVNEditor`
Parameters:
  `path` -
  `name` -
  `value` -
Throws:
  `SVNException`

### closeFile

public void closeFile(String path, String textChecksum) throws SVNException
Closes the current opened file.

Specified by:
  `closeFile` in interface `ISVNEditor`
Parameters:
  `path` -
  `textChecksum` -
Throws:
  `SVNException`

### closeEdit

public SVNCommitInfo closeEdit() throws SVNException
Commits the transaction.

Specified by:
  `closeEdit` in interface `ISVNEditor`
Returns:
  commit info
Throws:
  `SVNException`

### abortEdit

public void abortEdit() throws SVNException
Aborts the transaction.

Specified by:
  `abortEdit` in interface `ISVNEditor`
Throws:
  `SVNException`

### getCommitInfo

public SVNCommitInfo getCommitInfo()
Returns commit information on the revision committed to the replication destination repository.

Returns:
  commit info (revision, author, date)