当前位置: 首页>>代码示例>>Java>>正文


Java SVNRepository.setLocation方法代码示例

本文整理汇总了Java中org.tmatesoft.svn.core.io.SVNRepository.setLocation方法的典型用法代码示例。如果您正苦于以下问题:Java SVNRepository.setLocation方法的具体用法?Java SVNRepository.setLocation怎么用?Java SVNRepository.setLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.tmatesoft.svn.core.io.SVNRepository的用法示例。


在下文中一共展示了SVNRepository.setLocation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
 * Handles a request to retrieve a file from the repository.
 * 
 * @param source Path to the resource to retrieve, including the repository root.
 * @param destination The location where the file should be retrieved to.
 * @throws IOException If an error occurs retrieving the file.
 */
public void get(String source, File destination) throws IOException {
  fireTransferInitiated(getResource(source), TransferEvent.REQUEST_GET);
  String repositorySource = source;
  if (!source.startsWith(repositoryRoot)) {
    repositorySource = getRepositoryRoot() + source;
  }
  Message.debug("Getting file for user " + userName + " from " + repositorySource + " [revision="
      + svnRetrieveRevision + "] to " + destination.getAbsolutePath());
  try {
    SVNURL url = SVNURL.parseURIEncoded(repositorySource);
    SVNRepository repository = getRepository(url, true);
    repository.setLocation(url, false);

    Resource resource = getResource(source);
    fireTransferInitiated(resource, TransferEvent.REQUEST_GET);

    SvnDao svnDAO = new SvnDao(repository);
    svnDAO.getFile(url, destination, svnRetrieveRevision);

    fireTransferCompleted(destination.length());
  } catch (SVNException e) {
    Message.error("Error retrieving" + repositorySource + " [revision=" + svnRetrieveRevision + "]");
    throw (IOException) new IOException().initCause(e);
  }
}
 
开发者ID:massdosage,项目名称:ivysvn,代码行数:33,代码来源:SvnRepository.java

示例2: getRepository

import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
 * Gets a repository referencing the passed URL, with authentication setup based on the values currently set in this
 * object.
 * 
 * @param url Subversion repository URL.
 * @param cache Whether to cache repository reference.
 * @return An initialised repository object.
 * @throws SVNException If the URL or authentication credentials are invalid.
 */
private SVNRepository getRepository(SVNURL url, boolean cache) throws SVNException {
  SVNRepository repository = null;
  if (cache) {
    repository = SVNRepositoryCache.getInstance().getRepository(url, userName, userPassword, keyFile, sshPassphrase,
        portNumber, certFile, sslPassphrase, storageAllowed);
  } else {
    repository = SvnUtils.createRepository(url, userName, userPassword, keyFile, sshPassphrase, portNumber, certFile,
        sslPassphrase, storageAllowed);
    repository.setLocation(url, false);
  }
  return repository;
}
 
开发者ID:massdosage,项目名称:ivysvn,代码行数:22,代码来源:SvnRepository.java

示例3: getRepository

import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
 * Gets a repository instance for the passed URL. The same instance will be returned for the same protocol + host
 * combination. If the repository cannot be found in the cache a new one will be created, the passed parameters
 * determine the authentication mechanism which will be used for this. The returned repository will have its location
 * set to the passed url.
 * 
 * @param url A SVNURL object with at the very least the protocol and host set.
 * @param userName Subversion user name.
 * @param userPassword Subversion password.
 * @param keyFile SSH Key file.
 * @param sshPassphrase SSH key file passphrase.
 * @param portNumber SSH port number.
 * @param certFile SSL certificate file.
 * @param sslPassphrase SSL certificate passphrase.
 * @param storageAllowed Whether to allow credential storage or not.
 * @return A repository for the passed url.
 * @throws SVNException If an error occurs creating the repository.
 */
public synchronized SVNRepository getRepository(SVNURL url, String userName, String userPassword, File keyFile,
    String sshPassphrase, int portNumber, File certFile, String sslPassphrase, boolean storageAllowed)
  throws SVNException {
  String key = url.getProtocol() + ":" + url.getHost();
  SVNRepository repository = repositoryCache.get(key);
  if (repository == null) {
    repository = SvnUtils.createRepository(url, userName, userPassword, keyFile, sshPassphrase, portNumber, certFile,
        sslPassphrase, storageAllowed);
    repositoryCache.put(key, repository);
  }
  repository.setLocation(url, false);
  return repository;
}
 
开发者ID:massdosage,项目名称:ivysvn,代码行数:32,代码来源:SVNRepositoryCache.java


注:本文中的org.tmatesoft.svn.core.io.SVNRepository.setLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。