|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.statsvn.util.SvnInfoUtils
public class SvnInfoUtils
Utilities class that manages calls to svn info. Used to find repository information, latest revision numbers, and directories.
Nested Class Summary | |
---|---|
protected static class |
SvnInfoUtils.SvnInfoHandler
SAX parser for the svn info --xml command. |
Field Summary | |
---|---|
protected java.util.HashMap |
HM_REVISIONS
|
protected java.util.HashSet |
HS_DIRECTORIES
|
protected ISvnProcessor |
processor
|
protected static java.lang.String |
SVN_REPO_ROOT_NOTFOUND
|
Constructor Summary | |
---|---|
SvnInfoUtils(ISvnProcessor processor)
Invokes info using the svn info command line. |
Method Summary | |
---|---|
java.lang.String |
absolutePathToUrl(java.lang.String absolute)
Converts an absolute path in the repository to a URL, using the repository URL |
java.lang.String |
absoluteToRelativePath(java.lang.String absolute)
Converts an absolute path in the repository to a path relative to the working folder root. |
void |
addDirectory(java.lang.String relativePath)
Adds a directory to the list of known directories. |
void |
checkRepoRootAvailable()
Verifies that the "svn info" command can return the repository root (info available in svn >= 1.3.0) |
protected void |
clearCache()
|
boolean |
existsInWorkingCopy(java.lang.String relativePath)
Returns true if the file exists in the working copy (according to the svn metadata, and not file system checks). |
java.lang.String |
getModuleName()
Assumes #loadInfo(String) has been called. |
protected ISvnProcessor |
getProcessor()
|
java.lang.String |
getRepositoryUrl()
Assumes #loadInfo() has been invoked. |
java.lang.String |
getRepositoryUuid()
Assumes #loadInfo() has been invoked. |
java.lang.String |
getRevisionNumber(java.lang.String relativePath)
Returns the revision number of the file in the working copy. |
java.lang.String |
getRootRevisionNumber()
Assumes #loadInfo() has been invoked. |
java.lang.String |
getRootUrl()
Assumes #loadInfo() has been invoked. |
protected ProcessUtils |
getSvnInfo(boolean bRootOnly)
Invokes svn info. |
boolean |
isDirectory(java.lang.String relativePath)
Returns true if the path has been identified as a directory. |
protected boolean |
isQueryNeeded(boolean bRootOnly)
Do we need to re-invoke svn info? |
void |
loadInfo()
Initializes our representation of the repository. |
protected void |
loadInfo(boolean bRootOnly)
Loads the information from svn info if needed. |
void |
loadInfo(java.io.InputStream stream)
Loads the information from svn info if needed. |
java.lang.String |
relativePathToUrl(java.lang.String relative)
Converts a relative path in the working folder to a URL, using the working folder's root URL |
java.lang.String |
relativeToAbsolutePath(java.lang.String relative)
Converts a relative path in the working folder to an absolute path in the repository. |
protected void |
setRepositoryUrl(java.lang.String repositoryUrl)
Sets the project's repository URL. |
protected void |
setRepositoryUuid(java.lang.String repositoryUuid)
|
protected void |
setRootUrl(java.lang.String rootUrl)
Sets the project's root URL. |
java.lang.String |
urlToAbsolutePath(java.lang.String url)
Converts a url to an absolute path in the repository. |
java.lang.String |
urlToRelativePath(java.lang.String url)
Converts a url to a relative path in the repository. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String SVN_REPO_ROOT_NOTFOUND
protected ISvnProcessor processor
protected final java.util.HashMap HM_REVISIONS
protected final java.util.HashSet HS_DIRECTORIES
Constructor Detail |
---|
public SvnInfoUtils(ISvnProcessor processor)
Method Detail |
---|
protected ISvnProcessor getProcessor()
public java.lang.String absoluteToRelativePath(java.lang.String absolute)
ISvnInfoProcessor
absoluteToRelativePath
in interface ISvnInfoProcessor
absolute
- Example (assume getModuleName() returns /trunk/statsvn)
/trunk/statsvn/package.html
public java.lang.String absolutePathToUrl(java.lang.String absolute)
ISvnInfoProcessor
absolutePathToUrl
in interface ISvnInfoProcessor
absolute
- Example: /trunk/statsvn/package.html
public java.lang.String relativePathToUrl(java.lang.String relative)
ISvnInfoProcessor
relativePathToUrl
in interface ISvnInfoProcessor
relative
- Example: src/Messages.java
public java.lang.String relativeToAbsolutePath(java.lang.String relative)
ISvnInfoProcessor
relativeToAbsolutePath
in interface ISvnInfoProcessor
relative
- Example: src/Messages.java
public boolean existsInWorkingCopy(java.lang.String relativePath)
ISvnInfoProcessor
existsInWorkingCopy
in interface ISvnInfoProcessor
relativePath
- the path
public java.lang.String getModuleName()
ISvnInfoProcessor
getModuleName
in interface ISvnInfoProcessor
public java.lang.String getRevisionNumber(java.lang.String relativePath)
ISvnInfoProcessor
getRevisionNumber
in interface ISvnInfoProcessor
relativePath
- the filename
public java.lang.String getRootRevisionNumber()
ISvnInfoProcessor
getRootRevisionNumber
in interface ISvnInfoProcessor
public java.lang.String getRootUrl()
ISvnInfoProcessor
getRootUrl
in interface ISvnInfoProcessor
public java.lang.String getRepositoryUuid()
ISvnInfoProcessor
getRepositoryUuid
in interface ISvnInfoProcessor
public java.lang.String getRepositoryUrl()
ISvnInfoProcessor
getRepositoryUrl
in interface ISvnInfoProcessor
protected ProcessUtils getSvnInfo(boolean bRootOnly)
bRootOnly
- true if should we check for the root only or false otherwise
(recurse for all files)
public boolean isDirectory(java.lang.String relativePath)
ISvnInfoProcessor
isDirectory
in interface ISvnInfoProcessor
relativePath
- the path
public void addDirectory(java.lang.String relativePath)
ISvnInfoProcessor
addDirectory
in interface ISvnInfoProcessor
relativePath
- the relative path.protected boolean isQueryNeeded(boolean bRootOnly)
bRootOnly
- true if we need the root only
protected void loadInfo(boolean bRootOnly) throws net.sf.statcvs.input.LogSyntaxException, java.io.IOException
net.sf.statcvs.input.LogSyntaxException
- if the format of the svn info is invalid
java.io.IOException
- if we can't read from the response stream.bRootOnly
- load only the root?public void loadInfo(java.io.InputStream stream) throws net.sf.statcvs.input.LogSyntaxException, java.io.IOException
ISvnInfoProcessor
loadInfo
in interface ISvnInfoProcessor
net.sf.statcvs.input.LogSyntaxException
- if the format of the svn info is invalid
java.io.IOException
- if we can't read from the response stream.stream
- the input stream representing
an svn info command.protected void clearCache()
public void loadInfo() throws net.sf.statcvs.input.LogSyntaxException, java.io.IOException
ISvnInfoProcessor
loadInfo
in interface ISvnInfoProcessor
net.sf.statcvs.input.LogSyntaxException
- if the svn info --xml is malformed
java.io.IOException
- if there is an error reading from the streampublic java.lang.String urlToAbsolutePath(java.lang.String url)
ISvnInfoProcessor
urlToAbsolutePath
in interface ISvnInfoProcessor
url
- Examples: svn://svn.statsvn.org/statsvn/trunk/statsvn,
svn://svn.statsvn.org/statsvn/trunk/statsvn/package.html
public java.lang.String urlToRelativePath(java.lang.String url)
ISvnInfoProcessor
urlToRelativePath
in interface ISvnInfoProcessor
url
- Examples: svn://svn.statsvn.org/statsvn/trunk/statsvn,
svn://svn.statsvn.org/statsvn/trunk/statsvn/package.html
protected void setRootUrl(java.lang.String rootUrl)
rootUrl
- protected void setRepositoryUrl(java.lang.String repositoryUrl)
repositoryUrl
- protected void setRepositoryUuid(java.lang.String repositoryUuid)
public void checkRepoRootAvailable() throws SvnVersionMismatchException
checkRepoRootAvailable
in interface ISvnInfoProcessor
SvnVersionMismatchException
- if svn info failed to provide a non-empty repository root
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |