Package com.zfabrik.impl.svnaccess
Class SVNKitSvnRepository
- java.lang.Object
-
- com.zfabrik.impl.svnaccess.SVNKitSvnRepository
-
- All Implemented Interfaces:
com.zfabrik.svnaccess.ISvnRepository
,java.io.Closeable
,java.lang.AutoCloseable
public class SVNKitSvnRepository extends java.lang.Object implements com.zfabrik.svnaccess.ISvnRepository
SVNKit based implementation of our Svn Repo abstraction. Requires to have SVNKit on the classpath to load and work. This implementation will be picked bySvnClientAdapterResource
if an SVNKit library of version 1.7.9 or higher is found - as far as compatibility of SVNKit is established with that version.
-
-
Constructor Summary
Constructors Constructor Description SVNKitSvnRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
export(java.lang.String path, long pegRevision, java.io.File targetDir)
Exports the given directory content to the given target directory.java.lang.String
getBaseUrl()
void
getContent(java.lang.String path, long pegRevision, long revision, com.zfabrik.svnaccess.IStreamHandler streamHandler)
Retrieves the content of the given SVN URL and calls the given stream handler for the input streamjava.lang.String
getCRPath()
long
getCurrentCRRevision()
java.lang.String
getRepositoryUuid()
java.lang.String
getSvnRootUrl()
com.zfabrik.svnaccess.SvnInfo
info()
returns details about the base path at HEAD revisioncom.zfabrik.svnaccess.SvnInfo
info(java.lang.String path, long pegRevision)
returns details about a single pathint
list(java.lang.String path, long pegRevision, long revision, com.zfabrik.svnaccess.IDirEntryHandler dirEntryHandler)
Retrieves all direct children for the given SVN URL and calls the given resource handler for each childint
log(java.lang.String path, long pegRevision, long revisionFrom, long revisionTo, com.zfabrik.svnaccess.ISvnLogEntryHandler logEntryHandler)
Retrieves all changes for the given SVN URL and the given revision range and calls the given log entry handler for each change.void
setBaseUrl(java.lang.String baseUrl)
Sets the base URL - this is the z2 component repository URLvoid
setPassword(java.lang.String password)
Sets the password (like --password)void
setUsername(java.lang.String username)
Sets the username (like --username)
-
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
getBaseUrl
public java.lang.String getBaseUrl()
- Specified by:
getBaseUrl
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Returns:
- the repository base URL
-
setBaseUrl
public void setBaseUrl(java.lang.String baseUrl)
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
Sets the base URL - this is the z2 component repository URL- Specified by:
setBaseUrl
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Parameters:
baseUrl
- base URL
-
setUsername
public void setUsername(java.lang.String username)
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
Sets the username (like --username)- Specified by:
setUsername
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Parameters:
username
- svn user
-
setPassword
public void setPassword(java.lang.String password)
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
Sets the password (like --password)- Specified by:
setPassword
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Parameters:
password
- svn password
-
getRepositoryUuid
public java.lang.String getRepositoryUuid() throws java.io.IOException
- Specified by:
getRepositoryUuid
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Returns:
- repository UUID
- Throws:
java.io.IOException
-
getCurrentCRRevision
public long getCurrentCRRevision() throws java.io.IOException
- Specified by:
getCurrentCRRevision
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Returns:
- current SVNCR revision
- Throws:
java.io.IOException
-
getSvnRootUrl
public java.lang.String getSvnRootUrl() throws java.io.IOException
- Specified by:
getSvnRootUrl
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Returns:
- SVN-Repository root URL - e.g. "http://z2-environment.net/svn/z2-environment/"
- Throws:
java.io.IOException
-
getCRPath
public java.lang.String getCRPath() throws java.io.IOException
- Specified by:
getCRPath
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Returns:
- CR-path relative to SVN root URL - e.g. "/trunk/z2-base.base"
- Throws:
java.io.IOException
-
info
public com.zfabrik.svnaccess.SvnInfo info(java.lang.String path, long pegRevision) throws java.io.IOException
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
returns details about a single path- Specified by:
info
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Parameters:
path
- path relative to the component repositorypegRevision
- peg revision, use -1 for HEAD- Returns:
- an
SvnDirEntry
containing the details or null if the given path does not exist in the given revision - Throws:
java.io.IOException
-
info
public com.zfabrik.svnaccess.SvnInfo info() throws java.io.IOException
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
returns details about the base path at HEAD revision- Specified by:
info
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Returns:
- most current info of the base-path
- Throws:
java.io.IOException
-
log
public int log(java.lang.String path, long pegRevision, long revisionFrom, long revisionTo, com.zfabrik.svnaccess.ISvnLogEntryHandler logEntryHandler) throws java.io.IOException
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
Retrieves all changes for the given SVN URL and the given revision range and calls the given log entry handler for each change. If revisionFrom is greater than revisionTo the revision order is descending, otherwise it's ascending.- Specified by:
log
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Parameters:
path
- path relative to CR-rootpegRevision
- peg revision, use -1 for HEADrevisionFrom
- revision fromrevisionTo
- revision tologEntryHandler
- log entry handler is called for each changed resource- Returns:
- number of log entries
- Throws:
java.io.IOException
- if SVN LOG fails
-
list
public int list(java.lang.String path, long pegRevision, long revision, com.zfabrik.svnaccess.IDirEntryHandler dirEntryHandler) throws java.io.IOException
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
Retrieves all direct children for the given SVN URL and calls the given resource handler for each child- Specified by:
list
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Parameters:
path
- path relative to CR-rootpegRevision
- peg revision, use -1 for HEADrevision
- revision, use -1 for HEADdirEntryHandler
- resource handler- Returns:
- number of dir entries
- Throws:
java.io.IOException
- if SVN URL does not exist in the given revision
-
getContent
public void getContent(java.lang.String path, long pegRevision, long revision, com.zfabrik.svnaccess.IStreamHandler streamHandler) throws java.io.IOException
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
Retrieves the content of the given SVN URL and calls the given stream handler for the input stream- Specified by:
getContent
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Parameters:
path
- path relative to component repository URLpegRevision
- peg revision, use -1 for HEADrevision
- revisionstreamHandler
- stream handler- Throws:
java.io.IOException
- if SVN URL does not exist in the given revision
-
export
public void export(java.lang.String path, long pegRevision, java.io.File targetDir) throws java.io.IOException
Description copied from interface:com.zfabrik.svnaccess.ISvnRepository
Exports the given directory content to the given target directory. The directory will be overridden if it exists already!- Specified by:
export
in interfacecom.zfabrik.svnaccess.ISvnRepository
- Parameters:
path
- path relative to component repository URLpegRevision
- revision, use -1 for HEAD (we always use preg revision HEAD)targetDir
- target directory- Throws:
java.io.IOException
- if SVN URL does not exist in the given revision or targetDir refers to an existing file
-
-