📄 svnclientsynchronized.java
字号:
/**
* @copyright
* ====================================================================
* Copyright (c) 2003-2004 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://subversion.tigris.org/license-1.html.
* If newer versions of this license are posted there, you may use a
* newer version instead, at your option.
*
* This software consists of voluntary contributions made by many
* individuals. For exact contribution history, see the revision
* history and logs, available at http://subversion.tigris.org/.
* ====================================================================
* @endcopyright
*/
package org.tigris.subversion.javahl;
/**
* This class provides a threadsafe wrapped for SVNClient
*/
public class SVNClientSynchronized implements SVNClientInterface
{
/**
* the wrapped object, which does all the work
*/
private SVNClient worker;
/**
* our class, we synchronize on that.
*/
static private Class clazz = SVNClientSynchronized.class;
/**
* Create our worker
*/
public SVNClientSynchronized()
{
worker = new SVNClient();
}
/**
* release the native peer (should not depend on finalize)
*/
public void dispose()
{
worker.dispose();
}
/**
* Returns the last destination path submitted.
* @deprecated
* @return path in Subversion format.
*/
public String getLastPath()
{
synchronized(clazz)
{
return worker.getLastPath();
}
}
/**
* List a directory or file of the working copy.
*
* @param path Path to explore.
* @param descend Recurse into subdirectories if existant.
* @param onServer Request status information from server.
* @param getAll get status for uninteristing files (unchanged).
* @return Array of Status entries.
*/
public Status[] status(String path, boolean descend, boolean onServer,
boolean getAll) throws ClientException
{
synchronized(clazz)
{
return worker.status(path, descend, onServer, getAll);
}
}
/**
* List a directory or file of the working copy.
*
* @param path Path to explore.
* @param descend Recurse into subdirectories if existant.
* @param onServer Request status information from server.
* @param getAll get status for uninteristing files (unchanged).
* @param noIgnore get status for normaly ignored files and directories.
* @return Array of Status entries.
*/
public Status[] status(String path, boolean descend, boolean onServer,
boolean getAll, boolean noIgnore)
throws ClientException
{
synchronized(clazz)
{
return worker.status(path, descend, onServer, getAll, noIgnore);
}
}
/**
* Lists the directory entries of an url on the server.
* @param url the url to list
* @param revision the revision to list
* @param recurse recurse into subdirectories
* @return Array of DirEntry objects.
*/
public DirEntry[] list(String url, Revision revision, boolean recurse)
throws ClientException
{
synchronized(clazz)
{
return worker.list(url, revision, recurse);
}
}
/**
* Returns the status of a single file in the path.
*
* @param path File to gather status.
* @param onServer Request status information from the server.
* @return the subversion status of the file.
*/
public Status singleStatus(String path, boolean onServer)
throws ClientException
{
synchronized(clazz)
{
return worker.singleStatus(path, onServer);
}
}
/**
* Sets the username used for authentification.
* @param username the username
*/
public void username(String username)
{
synchronized(clazz)
{
worker.username(username);
}
}
/**
* Sets the password used for authification.
* @param password the password
*/
public void password(String password)
{
synchronized(clazz)
{
worker.password(password);
}
}
/**
* Register callback interface to supply username and password on demand
* @param prompt the callback interface
*/
public void setPrompt(PromptUserPassword prompt)
{
synchronized(clazz)
{
worker.setPrompt(prompt);
}
}
/**
* Retrieve the log messages for an item
* @param path path or url to get the log message for.
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @return array of LogMessages
*/
public LogMessage[] logMessages(String path, Revision revisionStart,
Revision revisionEnd) throws ClientException
{
synchronized(clazz)
{
return worker.logMessages(path, revisionStart, revisionEnd, true, false);
}
}
/**
* Retrieve the log messages for an item
* @param path path or url to get the log message for.
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @return array of LogMessages
*/
public LogMessage[] logMessages(String path, Revision revisionStart,
Revision revisionEnd, boolean stopOnCopy)
throws ClientException
{
synchronized(clazz)
{
return worker.logMessages(path, revisionStart, revisionEnd,
stopOnCopy, false);
}
}
/**
* Retrieve the log messages for an item
* @param path path or url to get the log message for.
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @param discoverPath returns the paths of the changed items in the
* returned objects
* @return array of LogMessages
*/
public LogMessage[] logMessages(String path, Revision revisionStart,
Revision revisionEnd, boolean stopOnCopy,
boolean discoverPath)
throws ClientException
{
synchronized(clazz)
{
return worker.logMessages(path, revisionStart, revisionEnd,
stopOnCopy, discoverPath);
}
}
/**
* Executes a revision checkout.
* @param moduleName name of the module to checkout.
* @param destPath destination directory for checkout.
* @param revision the revision to checkout.
* @param recurse whether you want it to checkout files recursively.
* @exception ClientException
*/
public long checkout(String moduleName, String destPath, Revision revision,
boolean recurse) throws ClientException
{
synchronized(clazz)
{
return worker.checkout(moduleName, destPath, revision, recurse);
}
}
/**
* Sets the notification callback used to send processing information back
* to the calling program.
* @param notify listener that the SVN library should call on many
* file operations.
*/
public void notification(Notify notify)
{
synchronized(clazz)
{
worker.notification(notify);
}
}
/**
* Sets the commit message handler. This allows more complex commit message
* with the list of the elements to be commited as input.
* @param messageHandler callback for entering commit messages
* if this is set the message parameter is ignored.
*/
public void commitMessageHandler(CommitMessage messageHandler)
{
synchronized(clazz)
{
worker.commitMessageHandler(messageHandler);
}
}
/**
* Sets a file for deletion.
* @param path path or url to be deleted
* @param message if path is a url, this will be the commit message.
* @param force delete even when there are local modifications.
* @exception ClientException
*/
public void remove(String[] path, String message, boolean force)
throws ClientException
{
synchronized(clazz)
{
worker.remove(path, message, force);
}
}
/**
* Reverts a file to a pristine state.
* @param path path of the file.
* @param recurse recurse into subdirectories
* @exception ClientException
*/
public void revert(String path, boolean recurse) throws ClientException
{
synchronized(clazz)
{
worker.revert(path, recurse);
}
}
/**
* Adds a file to the repository.
* @param path path to be added.
* @param recurse recurse into subdirectories
* @exception ClientException
*/
public void add(String path, boolean recurse) throws ClientException
{
synchronized(clazz)
{
worker.add(path, recurse);
}
}
/**
* Updates the directory or file from repository
* @param path target file.
* @param revision the revision number to checkout.
* Revision.HEAD will checkout the
* latest revision.
* @param recurse recursively update.
* @exception ClientException
*/
public long update(String path, Revision revision, boolean recurse)
throws ClientException
{
synchronized(clazz)
{
return worker.update(path, revision, recurse);
}
}
/**
* Commits changes to the repository.
* @param path files to commit.
* @param message log message.
* @param recurse whether the operation should be done recursively.
* @return Returns a long representing the revision. It returns a
* -1 if the revision number is invalid.
* @exception ClientException
*/
public long commit(String[] path, String message, boolean recurse)
throws ClientException
{
synchronized(clazz)
{
return worker.commit(path, message, recurse);
}
}
/**
* Copies a versioned file with the history preserved.
* @param srcPath source path or url
* @param destPath destination path or url
* @param message commit message if destPath is an url
* @param revision source revision
* @exception ClientException
*/
public void copy(String srcPath, String destPath, String message,
Revision revision) throws ClientException
{
synchronized(clazz)
{
worker.copy(srcPath, destPath, message, revision);
}
}
/**
* Moves or renames a file.
* @param srcPath source path or url
* @param destPath destination path or url
* @param message commit message if destPath is an url
* @param revision source revision
* @param force even with local modifications.
* @exception ClientException
*/
public void move(String srcPath, String destPath, String message,
Revision revision, boolean force) throws ClientException
{
synchronized(clazz)
{
worker.move(srcPath, destPath, message, revision, force);
}
}
/**
* Creates a directory directly in a repository or creates a
* directory on disk and schedules it for addition.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -