本文整理汇总了Java中org.tmatesoft.svn.core.io.SVNRepository.setAuthenticationManager方法的典型用法代码示例。如果您正苦于以下问题:Java SVNRepository.setAuthenticationManager方法的具体用法?Java SVNRepository.setAuthenticationManager怎么用?Java SVNRepository.setAuthenticationManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.tmatesoft.svn.core.io.SVNRepository
的用法示例。
在下文中一共展示了SVNRepository.setAuthenticationManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connectToSVNInstance
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public static SVNRepository connectToSVNInstance(String url, String usr,
String pass) {
SvnUtil.setupLibrary();
SVNRepository repository = null;
try {
repository = SvnUtil.createRepository(url);
} catch (SVNException svne) {
System.err
.println("error while creating an SVNRepository for location '"
+ url + "': " + svne.getMessage());
}
ISVNAuthenticationManager authManager = SVNWCUtil
.createDefaultAuthenticationManager(usr, pass);
repository.setAuthenticationManager(authManager);
try {
SvnUtil.verifySVNLocation(repository, url);
} catch (SVNException e) {
e.printStackTrace();
}
return repository;
}
示例2: createRepository
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Set up repository. This method also determines the head revision of the
* repository.
*
* @throws ConQATException
* if setup fails.
*/
protected SVNRepository createRepository() throws ConQATException {
DAVRepositoryFactory.setup();
FSRepositoryFactory.setup();
try {
SVNRepository repository = SVNRepositoryFactory.create(SVNURL
.parseURIEncoded(url));
ISVNAuthenticationManager authManager;
if (userName != null) {
authManager = SVNWCUtil.createDefaultAuthenticationManager(
userName, password);
} else {
authManager = SVNWCUtil.createDefaultAuthenticationManager();
}
repository.setAuthenticationManager(authManager);
return repository;
} catch (SVNException e) {
throw new ConQATException(e);
}
}
示例3: checkoutTest
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public void checkoutTest() throws SVNException {
String checkoutPath = "svn://localhost";
String username = "integration";
String password = "integration";
String checkoutRootPath = new File("/home/jeremie/Developpement/checkoutsvn").getAbsolutePath();
DAVRepositoryFactory.setup();
final SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(checkoutPath));
repository.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager(username, password));
final SVNClientManager clientManager = SVNClientManager.newInstance(null, repository.getAuthenticationManager());
final SVNUpdateClient updateClient = clientManager.getUpdateClient();
updateClient.setIgnoreExternals(false);
final SVNNodeKind nodeKind = repository.checkPath("", -1);
if (nodeKind == SVNNodeKind.NONE) {
System.err.println("There is no entry at '" + checkoutPath + "'.");
System.exit(1);
} else if (nodeKind == SVNNodeKind.FILE) {
System.err.println("The entry at '" + checkoutPath + "' is a file while a directory was expected.");
System.exit(1);
}
System.out.println("*** CHECKOUT SVN Trunk/Branches ***");
System.out.println("Checkout source: " + checkoutPath);
System.out.println("Checkout destination: " + checkoutRootPath);
System.out.println("...");
try {
traverse(updateClient, repository, checkoutPath, checkoutRootPath, "", true);
} catch (final Exception e) {
System.err.println("ERROR : " + e.getMessage());
e.printStackTrace(System.err);
System.exit(-1);
}
System.out.println("");
System.out.println("Repository latest revision: " + repository.getLatestRevision());
}
示例4: getRepository
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Returns the SVN repository used to manage metadata versions in this
* store.
*
* @return the SVN repository used to manage metadata versions in this
* store.
*/
SVNRepository getRepository() throws SVNException {
SVNRepository repository = SVNRepositoryFactory.create(repURL);
String user = MCRSessionMgr.getCurrentSession().getUserInformation().getUserID();
SVNAuthentication[] auth = {
SVNUserNameAuthentication.newInstance(user, false, repURL, false) };
BasicAuthenticationManager authManager = new BasicAuthenticationManager(auth);
repository.setAuthenticationManager(authManager);
return repository;
}
示例5: getRepository
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private SVNRepository getRepository(String url) throws SVNException {
DAVRepositoryFactory.setup();
SVNURL svnUrl = SVNURL.parseURIEncoded(url);
SVNRepository repository = SVNRepositoryFactory.create(svnUrl, null);
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager();
repository.setAuthenticationManager(authManager);
return repository;
}
示例6: createRepository
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Override
public SVNRepository createRepository(SVNURL url, boolean mayReuse) throws SVNException {
final SVNRepository repos = SVNRepositoryFactory.create(url, this);
repos.setAuthenticationManager(myManager);
repos.setTunnelProvider(myTunnelProvider);
repos.setDebugLog(new ProxySvnLog(SVNDebugLog.getDefaultLog()));
repos.setCanceller(new MyCanceller());
return repos;
}
示例7: createRepository
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@NotNull
public SVNRepository createRepository(@NotNull SVNURL url) throws SVNException {
SVNRepository repository = SVNRepositoryFactory.create(url);
repository.setAuthenticationManager(getAuthenticationManager());
repository.setTunnelProvider(getSvnOptions());
return repository;
}
示例8: getSvnRepository
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private SVNRepository getSvnRepository(String url) throws SVNException {
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(
settings.getUsername(), settings.getPassword());
repository.setAuthenticationManager(authManager);
return repository;
}
示例9: apply
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public BasicSVNOperations apply(final HttpServletRequest request) {
DAVRepositoryFactory.setup();
SVNRepository repository = createRepository();
UsernamePassword credentials = getBasicAuthCredentials(request.getHeader("Authorization"));
// To get proxy support for testing/debug:
// repository.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager());
repository.setAuthenticationManager(new BasicAuthenticationManager(credentials.getUsername(), credentials.getPassword()));
request.setAttribute(RequestAttributes.USERNAME, credentials.getUsername());
return new RepositoryBasicSVNOperations(repository, _autoPropertiesApplier);
}
示例10: main
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
DAVRepositoryFactory.setup();
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded("https://svn-dev-plaintext.int.corefiling.com/svn/web/wiki/dsl"));
repository.setAuthenticationManager(SVNWCUtil.createDefaultAuthenticationManager());
RepositoryBasicSVNOperations operations = new RepositoryBasicSVNOperations(repository, null);
SVNPageStore store = new SVNPageStore("wiki", new InMemoryDeletedRevisionTracker(), operations, null, null);
for (AttachmentHistory attachment : store.attachments(new PageReferenceImpl("Printing"))) {
System.err.println(attachment.getName());
}
}
示例11: getSVNReposForRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private SVNRepository getSVNReposForRevision(final SVNRepository repository, final long revision) throws SVNException {
SVNClientManager manager = SVNClientManager.newInstance(SVNWCUtil.createDefaultOptions(true), repository.getAuthenticationManager());
try {
SVNWCClient client = manager.getWCClient();
SVNInfo info1 = client.doInfo(repository.getLocation(), SVNRevision.HEAD, SVNRevision.create(revision));
SVNRepository reposForRev = SVNRepositoryFactory.create(info1.getURL());
reposForRev.setAuthenticationManager(repository.getAuthenticationManager());
return reposForRev;
}
finally {
manager.dispose();
}
}
示例12: getRepository
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* 获取svn仓库
* @param pj 项目
* @return svn仓库
* @throws SVNException svn异常,例如没有权限等
*/
public SVNRepository getRepository(Pj pj) throws SVNException{
Usr usr = UsrProvider.getCurrentUsr();
String svnUrl = parseURL(pj.getUrl());
if(StringUtils.isBlank(svnUrl)){
throw new RuntimeException(I18N.getLbl("pj.error.url", "URL不可以为空"));
}
String svnUserName = usr.getUsr();
String svnPassword = usr.getPsw();
if(!Constants.HTTP_MUTIL.equals(pj.getType())){
//pj_usr覆盖用户的密码
PjUsr pjUsr = pjUsrDao.get(pj.getPj(), svnUserName);
if(pjUsr != null){
svnPassword = pjUsr.getPsw();
}
}
svnPassword = EncryptUtil.decrypt(svnPassword);//解密
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(svnUrl));
ISVNAuthenticationManager authManager =
SVNWCUtil.createDefaultAuthenticationManager(svnUserName, svnPassword);
repository.setAuthenticationManager(authManager);
return repository;
}
示例13: openSvnRepository
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@NotNull
private SVNRepository openSvnRepository(@NotNull SVNURL url) throws SVNException {
final SVNRepository repo = SVNRepositoryFactory.create(url);
if (authManager != null) {
repo.setAuthenticationManager(authManager);
}
return repo;
}
示例14: getRequestedDAVResource
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@Override
public DAVResource getRequestedDAVResource(boolean isSVNClient, String deltaBase, String pathInfo, long version, String clientOptions,
String baseChecksum, String resultChecksum, String label, boolean useCheckedIn, List lockTokens, Map capabilities) throws SVNException {
pathInfo = pathInfo == null ? getResourcePathInfo() : pathInfo;
// use latest version, if no version was specified
SVNRepository resourceRepository = SVNGitRepositoryFactory.create(SVNURL.parseURIEncoded(getResourceRepositoryRoot()));
if ( version == -1 )
{
version = resourceRepository.getLatestRevision();
}
DAVResourceURI resourceURI = new DAVResourceURI(getResourceContext(), pathInfo, label, useCheckedIn, version);
DAVConfig config = getDAVConfig();
String fsParentPath = config.getRepositoryParentPath();
String xsltURI = config.getXSLTIndex();
String reposName = config.getRepositoryName();
String uri = resourceURI.getURI();
if (fsParentPath != null && getDAVConfig().isListParentPath()) {
if (uri.endsWith("/")) {
uri = uri.substring(0, uri.length() - 1);
}
//TODO: later add code for parent path resource here
}
SVNDebugLog.getDefaultLog().logFine(SVNLogType.DEFAULT, "uri type - " + resourceURI.getType() + ", uri kind - " + resourceURI.getKind());
String activitiesDB = config.getActivitiesDBPath();
File activitiesDBDir = null;
if (activitiesDB == null) {
activitiesDBDir = new File(myRepositoryRootDir, DEFAULT_ACTIVITY_DB);
} else {
activitiesDBDir = new File(activitiesDB);
}
String userName = myUserPrincipal != null ? myUserPrincipal.getName() : null;
SVNAuthentication auth = new SVNUserNameAuthentication(userName, false, null, false);
BasicAuthenticationManager authManager = new BasicAuthenticationManager(new SVNAuthentication[] { auth });
resourceRepository.setAuthenticationManager(authManager);
SVNDebugLog.getDefaultLog().logFine(SVNLogType.DEFAULT, "revision: " + resourceURI.getRevision());
DAVResource resource = new DAVResource(resourceRepository, this, resourceURI, isSVNClient, deltaBase, version,
clientOptions, baseChecksum, resultChecksum, userName, activitiesDBDir, lockTokens, capabilities);
return resource;
}
示例15: authenticate
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public static void authenticate(String usr, String pass, SVNRepository repo) {
ISVNAuthenticationManager authManager = SVNWCUtil
.createDefaultAuthenticationManager(usr, pass);
repo.setAuthenticationManager(authManager);
}