本文整理汇总了Java中org.tmatesoft.svn.core.auth.ISVNAuthenticationManager类的典型用法代码示例。如果您正苦于以下问题:Java ISVNAuthenticationManager类的具体用法?Java ISVNAuthenticationManager怎么用?Java ISVNAuthenticationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ISVNAuthenticationManager类属于org.tmatesoft.svn.core.auth包,在下文中一共展示了ISVNAuthenticationManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connectToSVNInstance
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的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: init
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
private void init() {
logger.info("Creating MySVNClient for svn " + svn_url + ", username " + username + ", password " + password.replaceAll(".", "\\*"));
DAVRepositoryFactory.setup( );
SVNURL url;
try {
url = SVNURL.parseURIDecoded(svn_url);
repository = SVNRepositoryFactory.create( url );
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( username , password );
repository.setAuthenticationManager( authManager );
} catch (SVNException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例3: requestClientAuthentication
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
public SVNAuthentication requestClientAuthentication(final String kind,
final SVNURL url,
final String realm,
SVNErrorMessage errorMessage,
final SVNAuthentication previousAuth,
final boolean authMayBeStored) {
if (ApplicationManager.getApplication().isUnitTestMode() && ISVNAuthenticationManager.USERNAME.equals(kind)) {
final String userName = previousAuth != null && previousAuth.getUserName() != null ? previousAuth.getUserName() : SystemProperties.getUserName();
return new SVNUserNameAuthentication(userName, false);
}
final SvnAuthenticationNotifier.AuthenticationRequest obj =
new SvnAuthenticationNotifier.AuthenticationRequest(myProject, kind, url, realm);
final SVNURL wcUrl = myAuthenticationNotifier.getWcUrl(obj);
if (wcUrl == null || ourForceInteractive.contains(Thread.currentThread())) {
// outside-project url
return mySvnInteractiveAuthenticationProvider.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
} else {
if (myAuthenticationNotifier.ensureNotify(obj)) {
return myAuthenticationManager.requestFromCache(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
}
}
return null;
}
示例4: getKinds
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
@NotNull
public static List<String> getKinds(final SVNURL url, boolean passwordRequest) {
if (passwordRequest || "http".equals(url.getProtocol())) {
return Collections.singletonList(ISVNAuthenticationManager.PASSWORD);
}
else if ("https".equals(url.getProtocol())) {
return Collections.singletonList(ISVNAuthenticationManager.SSL);
}
else if ("svn".equals(url.getProtocol())) {
return Collections.singletonList(ISVNAuthenticationManager.PASSWORD);
}
else if (url.getProtocol().contains("svn+")) { // todo +-
return Arrays.asList(ISVNAuthenticationManager.SSH, ISVNAuthenticationManager.USERNAME);
}
return Collections.singletonList(ISVNAuthenticationManager.USERNAME);
}
示例5: performSVNupdate
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
/**
* @param svnPathString
* String which contains the local SVN folder path.
* @return Error code. If true --> SVN Operation failed.
*/
public final boolean performSVNupdate(final String svnPathString) {
SfdcCommander commander = SfdcCommander.getInstance();
boolean error = false;
File svnPath = new File(svnPathString);
// checkout
try {
ISVNAuthenticationManager authManager = getAuthManager(config);
SVNUpdateClient updateClient = new SVNUpdateClient(authManager,
SVNWCUtil.createDefaultOptions(true));
updateClient.doUpdate(svnPath, SVNRevision.HEAD, SVNDepth.INFINITY,
true, true);
commander.info("SVN Update successfully processed.");
} catch (SVNException e) {
commander.info(e.getMessage());
error = true;
}
return error;
}
示例6: performSVNcommit
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
/**
* @param svnPathString
* String which contains the local SVN folder path.
* @param aComment
* The SVN Comment which has been entered.
* @param aConfig
* CommanderConfig for SVN Connect.
* @return Error code. If true --> SVN Operation failed.
*/
public final boolean performSVNcommit(final String svnPathString,
final String aComment, final CommanderConfig aConfig) {
SfdcCommander commander = SfdcCommander.getInstance();
boolean error = false;
File[] paths = new File[1];
// paths[0] = projectFile;
// boolean svnNew = false;
// svn add
SVNProperties props = new SVNProperties();
try {
ISVNAuthenticationManager authManager = getAuthManager(config);
// if (svnNew) {
// SVNWCClient addClient = new SVNWCClient(authManager,
// SVNWCUtil.createDefaultOptions(true));
// addClient.doAdd(projectFile, true, false, true,
// SVNDepth.INFINITY, true, true);
// commander.notify("Projectfile successfully added.");
// }
// commit
SVNCommitClient commitClient = new SVNCommitClient(authManager,
SVNWCUtil.createDefaultOptions(true));
commitClient.doCommit(paths, false, aComment, props, null, false,
true, SVNDepth.INFINITY);
commander.info("Projectfile successfully commited.");
} catch (SVNException e) {
commander.info(e.getMessage());
error = true;
}
return error;
}
示例7: checkout
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
private File checkout(String scmUrl) throws Exception {
ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
ISVNAuthenticationManager isvnAuthenticationManager = SVNWCUtil.createDefaultAuthenticationManager(null, null, (char[]) null, false);
SVNClientManager svnClientManager = SVNClientManager.newInstance(options, isvnAuthenticationManager);
File out = temp.newFolder();
SVNUpdateClient updateClient = svnClientManager.getUpdateClient();
SvnCheckout co = updateClient.getOperationsFactory().createCheckout();
co.setUpdateLocksOnDemand(updateClient.isUpdateLocksOnDemand());
co.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(scmUrl), SVNRevision.HEAD));
co.setSingleTarget(SvnTarget.fromFile(out));
co.setRevision(SVNRevision.HEAD);
co.setDepth(SVNDepth.INFINITY);
co.setAllowUnversionedObstructions(false);
co.setIgnoreExternals(updateClient.isIgnoreExternals());
co.setExternalsHandler(SvnCodec.externalsHandler(updateClient.getExternalsHandler()));
co.setTargetWorkingCopyFormat(wcVersion);
co.run();
return out;
}
示例8: getCommits
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
@Override
public List<Commit> getCommits() {
System.out.println("Getting commit log...");
ISVNAuthenticationManager authManager = SVNWCUtil
.createDefaultAuthenticationManager("guest", "");
svn_client.setAuthenticationManager(authManager);
SVNLogClient log_client = svn_client.getLogClient();
try {
log_client.doLog(SVN_url, new String[] { "" },
SVNRevision.UNDEFINED, revision_range.getStartRevision(),
revision_range.getEndRevision(), false, true, 0,
log_handler);
} catch (SVNException e) {
e.printStackTrace();
}
return log_handler.getCommits();
}
示例9: getAuthManager
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
private ISVNAuthenticationManager getAuthManager()
{
if ( getPrivateKey() != null )
{
SVNSSHAuthentication[] auth = new SVNSSHAuthentication[1];
auth[0] = new SVNSSHAuthentication( getUser(), getPrivateKey().toCharArray(), getPassphrase(), -1, false );
return new BasicAuthenticationManager( auth );
}
else if ( getUser() != null )
{
return new BasicAuthenticationManager( getUser(), getPassword() );
}
else
{
String configDirectory = SvnUtil.getSettings().getConfigDirectory();
return SVNWCUtil.createDefaultAuthenticationManager(
configDirectory == null ? null : new File( configDirectory ), getUser(), getPassword(),
SvnUtil.getSettings().isUseAuthCache() );
}
}
示例10: openRepository
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
private void openRepository() throws Exception {
repository = null;
try {
repository = SVNRepositoryFactory.create(SVNURL
.parseURIEncoded(this.url));
} catch (SVNException svne) {
logger.log(Level.WARNING,
"error while creating an SVNRepository for the location '"
+ this.url + "': " + svne.getMessage(), true);
// StateBar.setState(Icons.ERROR, stateOpenRepositoryFailed);
throw new Exception("Can't access svn!!!");
}
ISVNAuthenticationManager authManager = SVNWCUtil
.createDefaultAuthenticationManager(name, password);
repository.setAuthenticationManager(authManager);
}
示例11: createRepository
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的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);
}
}
示例12: requestClientAuthentication
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
public SVNAuthentication requestClientAuthentication(final String kind,
final SVNURL url,
final String realm,
SVNErrorMessage errorMessage,
final SVNAuthentication previousAuth,
final boolean authMayBeStored) {
if (ApplicationManager.getApplication().isUnitTestMode() && ISVNAuthenticationManager.USERNAME.equals(kind)) {
final String userName = previousAuth != null && previousAuth.getUserName() != null ? previousAuth.getUserName() : SystemProperties.getUserName();
return new SVNUserNameAuthentication(userName, false);
}
final SvnAuthenticationNotifier.AuthenticationRequest obj =
new SvnAuthenticationNotifier.AuthenticationRequest(myProject, kind, url, realm);
final SVNURL wcUrl = myAuthenticationNotifier.getWcUrl(obj);
if (wcUrl == null || ourForceInteractive.contains(Thread.currentThread())) {
// outside-project url
return mySvnInteractiveAuthenticationProvider.requestClientAuthentication(kind, url, realm, errorMessage, previousAuth, authMayBeStored);
} else {
if (myAuthenticationNotifier.ensureNotify(obj)) {
return (SVNAuthentication) myAuthenticationStorage.getData(kind, realm);
}
}
return null;
}
示例13: logModificacoesSVN
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
public void logModificacoesSVN() throws SVNException {
ISVNAuthenticationManager aManager = SVNWCUtil.createDefaultAuthenticationManager("kann", senha_ic);
SVNURL url = SVNURL.parseURIEncoded(SVN_PEIXE_ESPADA);
SVNRepository repos = SVNRepositoryFactory.create(url);
repos.setAuthenticationManager(aManager);
long headRevision = repos.getLatestRevision();
Collection<SVNDirEntry> entriesList = repos.getDir("", headRevision, null, (Collection) null);
for (SVNDirEntry entry : entriesList) {
System.out.println("Entrada: " + entry.getName());
System.out.println("Última modificação da revisão: " + entry.getDate() +
" por " + entry.getAuthor());
System.out.println(" --> MSG: "+entry.getCommitMessage());
}
}
示例14: getRepository
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的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;
}
示例15: getWithActive
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; //导入依赖的package包/类
@Override
protected boolean getWithActive(final SvnAuthenticationManager active) throws SVNException {
if (ISVNAuthenticationManager.SSL.equals(myKind)) {
if (super.getWithActive(active)) return true;
}
myAuthentication = active.getProvider().requestClientAuthentication(myKind, myUrl, myRealm, null, null, true);
myStoreInUsual = myAuthenticationService.getTempDirectory() == null && myAuthentication != null && myAuthentication.isStorageAllowed();
return myAuthentication != null;
}