/** * Gets the Universal Unique IDentifier (UUID) of the repository this * driver is created for. * * @param forceConnection if <span class="javakeyword">true</span> then forces * this driver to test a connection - try to access a * repository * @return the UUID of a repository * @throws SVNException in case the repository could not be connected * @throws org.tmatesoft.svn.core.SVNAuthenticationException in case of authentication problems */ public String getRepositoryUUID(boolean forceConnection) throws SVNException { if (forceConnection && myRepositoryUUID == null) { testConnection(); } return myRepositoryUUID; }
/** * Gets the Universal Unique IDentifier (UUID) of the repository this * driver is created for. * * @param forceConnection if <span class="javakeyword">true</span> then forces * this driver to test a connection - try to access a * repository * @return the UUID of a repository * @throws SVNException */ public String getRepositoryUUID(boolean forceConnection) throws SVNException { if (forceConnection && myRepositoryUUID == null) { testConnection(); } return myRepositoryUUID; }
/** * Gets the Universal Unique IDentifier (UUID) of the repository this * driver is created for. * * @param forceConnection if <span class="javakeyword">true</span> then forces * this driver to test a connection - try to access a * repository * @return the UUID of a repository * @throws SVNException in case the repository could not be connected * @throws org.tmatesoft.svn.core.SVNAuthenticationException in case of authentication problems */ public String getRepositoryUUID(boolean forceConnection) throws SVNException { if (forceConnection && myRepositoryUUID == null) { testConnection(); } return myRepositoryUUID; }
/** * Gets the Universal Unique IDentifier (UUID) of the repository this * driver is created for. * * @param forceConnection if <span class="javakeyword">true</span> then forces * this driver to test a connection - try to access a * repository * @return the UUID of a repository * @throws SVNException in case the repository could not be connected * @throws org.tmatesoft.svn.core.SVNAuthenticationException in case of authentication problems */ public String getRepositoryUUID(boolean forceConnection) throws SVNException { if (forceConnection && myRepositoryUUID == null) { testConnection(); } return myRepositoryUUID; }
/** * Gets a repository's root directory location. * If this driver object is switched to a different repository location during * runtime (probably to an absolutely different repository, see {@link #setLocation(SVNURL, boolean) setLocation()}), * the root directory location may be changed. * * @param forceConnection if <span class="javakeyword">true</span> then forces * this driver to test a connection - try to access a * repository * @return the repository root directory location url * @throws SVNException * @see #testConnection() */ public SVNURL getRepositoryRoot(boolean forceConnection) throws SVNException { if (forceConnection && myRepositoryRoot == null) { testConnection(); } return myRepositoryRoot; }
/** * Gets a repository's root directory location. * If this driver object is switched to a different repository location during * runtime (probably to an absolutely different repository, see {@link #setLocation(SVNURL, boolean) setLocation()}), * the root directory location may be changed. * This method may need to establish connection with the repository * if the information on the repository's root location has not been received yet from the repository. * * @param forceConnection if <span class="javakeyword">true</span> then forces * this driver to test a connection - try to access a * repository * @return the repository root directory location url * @throws SVNException in case the repository could not be connected * @throws org.tmatesoft.svn.core.SVNAuthenticationException in case of authentication problems * @see #testConnection() */ public SVNURL getRepositoryRoot(boolean forceConnection) throws SVNException { if (forceConnection && myRepositoryRoot == null) { testConnection(); } return myRepositoryRoot; }
/** * Gets a repository's root directory location. * If this driver object is switched to a different repository location during * runtime (probably to an absolutely different repository, see {@link #setLocation(SVNURL, boolean) setLocation()}), * the root directory location may be changed. * This method may need to establish connection with the repository * if the information on the repository's root location has not been received yet from the repository. * * @param forceConnection if <span class="javakeyword">true</span> then forces * this driver to test a connection - try to access a * repository * @return the repository root directory location url * @throws SVNException in case the repository could not be connected * @throws org.tmatesoft.svn.core.SVNAuthenticationException in case of authentication problems * @see #testConnection() */ public SVNURL getRepositoryRoot(boolean forceConnection) throws SVNException { if (forceConnection && myRepositoryRoot == null) { testConnection(); } return myRepositoryRoot; }
/** * Gets a repository's root directory location. * If this driver object is switched to a different repository location during * runtime (probably to an absolutely different repository, see {@link #setLocation(SVNURL, boolean) setLocation()}), * the root directory location may be changed. * This method may need to establish connection with the repository * if the information on the repository's root location has not been received yet from the repository. * * @param forceConnection if <span class="javakeyword">true</span> then forces * this driver to test a connection - try to access a * repository * @return the repository root directory location url * @throws SVNException in case the repository could not be connected * @throws org.tmatesoft.svn.core.SVNAuthenticationException in case of authentication problems * @see #testConnection() */ public SVNURL getRepositoryRoot(boolean forceConnection) throws SVNException { if (forceConnection && myRepositoryRoot == null) { testConnection(); } return myRepositoryRoot; }
public boolean testSVNConnection(String svnURL,String svnUser,String svnPass){ DAVRepositoryFactory.setup(); String url="https://your_svn_host/path/"; String name="username"; String password="password"; SVNRepository repository = null; try { repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url)); ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password); repository.setAuthenticationManager(authManager); repository.testConnection(); System.out.println("Connection done.."); return true; } catch (SVNException e){ System.out.println("Not connected"); e.printStackTrace(); return false; } }
/** * Repository UUID. Lazy computed and cached. */ public UUID getUUID(AbstractProject context) throws SVNException { if (repositoryUUID == null || repositoryRoot == null) { synchronized (this) { SVNRepository r = openRepository(context); r.testConnection(); // make sure values are fetched repositoryUUID = UUID.fromString(r.getRepositoryUUID(false)); repositoryRoot = r.getRepositoryRoot(false); } } return repositoryUUID; }
/** * Repository UUID. Lazy computed and cached. */ public UUID getUUID(AbstractProject context) throws SVNException { if (repositoryUUID == null || repositoryRoot == null) { synchronized (this) { SVNRepository r = openRepository(context); r.testConnection(); // make sure values are fetched repositoryUUID = UUID.fromString(r.getRepositoryUUID(false)); repositoryRoot = r.getRepositoryRoot(false); } } return repositoryUUID; }
/** * Repository UUID. Lazy computed and cached. */ public UUID getUUID(Job context, SCM scm) throws SVNException { if(repositoryUUID==null || repositoryRoot==null) { LOGGER.fine("UUID of " + remote + " not cached for " + context); synchronized (this) { // don't keep connections open for further use to prevent having too many open at the same time. SVNRepository r = openRepository(context, scm, false); if (r.getRepositoryUUID(false) == null) r.testConnection(); // make sure values are fetched repositoryUUID = UUID.fromString(r.getRepositoryUUID(false)); repositoryRoot = r.getRepositoryRoot(true); } } return repositoryUUID; }
public void testConnection() throws SVNException { String encodedUrl = SVNEncodingUtil.autoURIEncode(addressSvn); SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(encodedUrl)); repository.setAuthenticationManager(authManager); repository.testConnection(); }
private SVNRepository setupRepo(String _path) throws RepoMismatchException { // Set repository for given URL (+ trunk or tag suffix) String tmp = null; // Build repository URL (incl. path) if(_path==null) tmp = this.url.toString(); else tmp = this.url.toString() + (this.url.toString().endsWith("/") ? "" : "/") + _path; SVNRepository repo = null; try { SVNURL url = SVNURL.parseURIEncoded(tmp); //SVN2Client.log.debug("Environment proxy (host:port): " + System.getProperty("http.proxyHost") + ":" + System.getProperty("http.proxyPort")); SvnClient.log.info("SVNKIT proxy configuration (host:port): " + authManager.getProxyManager(url).getProxyHost() + ":" + authManager.getProxyManager(url).getProxyPort()); repo = SVNRepositoryFactory.create(url); repo.setAuthenticationManager(authManager); repo.testConnection(); } catch(SVNException e) { e.printStackTrace(); throw new RepoMismatchException(this, tmp, e); // "Cannot create SVN repository from URL '" + tmp + "': " + e.getMessage()); } return repo; }
private boolean checkPassword(SVNURL url, String user, String password) throws SVNException { SVNRepository svnRepository = SVNRepositoryFactory.create(url); try { svnRepository.setAuthenticationManager(new BasicAuthenticationManager(user, password)); svnRepository.testConnection(); return true; } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_AUTHORIZED) { return false; } else { throw e; } } finally { svnRepository.closeSession(); } }
public SVNNodeKind checkRepositoryPath(AbstractProject context, SVNURL repoURL) throws SVNException { SVNRepository repository = null; try { repository = getRepository(context, repoURL); repository.testConnection(); long rev = repository.getLatestRevision(); String repoPath = getRelativePath(repoURL, repository); return repository.checkPath(repoPath, rev); } finally { if (repository != null) { repository.closeSession(); } } }
public SVNNodeKind checkRepositoryPath(AbstractProject context, SVNURL repoURL) throws SVNException { SVNRepository repository = null; try { repository = getRepository(context, repoURL); repository.testConnection(); long rev = repository.getLatestRevision(); String repoPath = getRelativePath(repoURL, repository); return repository.checkPath(repoPath, rev); } finally { if (repository != null) { repository.closeSession(); } } }
private void attemptAccess(ISVNAuthenticationManager m) throws SVNException { SVNRepository repository = SVNRepositoryFactory.create(repo); try { repository.setAuthenticationManager(m); repository.testConnection(); } finally { repository.closeSession(); } }
/** * {@inheritDoc} */ @Override public void testConnection(ScmCriteria criteria) throws Exception { SVNRepository repository = null; try { repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(criteria.getServer())); if (criteria.isAuth()) { repository.setAuthenticationManager(FactoryAuthenticationManager.create(criteria)); } repository.testConnection(); } finally { if (repository != null) { repository.closeSession(); } } }
/** * Submits the authentication info. * * This code is fairly ugly because of the way SVNKit handles credentials. */ public void postCredential(String url, final UserProvidedCredential upc, PrintWriter logWriter) throws SVNException, IOException { SVNRepository repository = null; try { // the way it works with SVNKit is that // 1) svnkit calls AuthenticationManager asking for a credential. // this is when we can see the 'realm', which identifies the user domain. // 2) DefaultSVNAuthenticationManager returns the username and password we set below // 3) if the authentication is successful, svnkit calls back acknowledgeAuthentication // (so we store the password info here) repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url)); repository.setTunnelProvider( createDefaultSVNOptions() ); AuthenticationManagerImpl authManager = upc.new AuthenticationManagerImpl(logWriter); authManager.setAuthenticationForced(true); repository.setAuthenticationManager(authManager); repository.testConnection(); authManager.checkIfProtocolCompleted(); } finally { if (repository != null) repository.closeSession(); } }