| 5 |
|
import java.io.File; |
| 6 |
|
import java.util.Vector; |
| 7 |
|
|
| 8 |
+ |
import net.oni2.ProxySettings; |
| 9 |
+ |
|
| 10 |
|
import org.tmatesoft.svn.core.SVNDepth; |
| 11 |
|
import org.tmatesoft.svn.core.SVNDirEntry; |
| 12 |
|
import org.tmatesoft.svn.core.SVNException; |
| 13 |
|
import org.tmatesoft.svn.core.SVNURL; |
| 14 |
+ |
import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; |
| 15 |
+ |
import org.tmatesoft.svn.core.auth.SVNAuthentication; |
| 16 |
|
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; |
| 17 |
|
import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory; |
| 18 |
|
import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; |
| 33 |
|
|
| 34 |
|
SVNClientManager svnCManager = null; |
| 35 |
|
|
| 36 |
< |
/** |
| 33 |
< |
* Constructor |
| 34 |
< |
*/ |
| 35 |
< |
public SVN() { |
| 36 |
> |
private void setup() { |
| 37 |
|
// For using over http:// and https:// |
| 38 |
|
DAVRepositoryFactory.setup(); |
| 39 |
|
// For using over svn:// and svn+xxx:// |
| 40 |
|
SVNRepositoryFactoryImpl.setup(); |
| 41 |
|
// For using over file:/// |
| 42 |
|
FSRepositoryFactory.setup(); |
| 43 |
+ |
} |
| 44 |
+ |
|
| 45 |
+ |
private void setProxy(BasicAuthenticationManager authMan) { |
| 46 |
+ |
ProxySettings prox = ProxySettings.getInstance(); |
| 47 |
+ |
if (prox.validate()) { |
| 48 |
+ |
authMan.setProxy(prox.getHostOrIp(), prox.getPort(), null, null); |
| 49 |
+ |
} |
| 50 |
+ |
} |
| 51 |
+ |
|
| 52 |
+ |
private BasicAuthenticationManager getAuthManager() { |
| 53 |
+ |
BasicAuthenticationManager auth = new BasicAuthenticationManager( |
| 54 |
+ |
new SVNAuthentication[0]); |
| 55 |
+ |
setProxy(auth); |
| 56 |
+ |
return auth; |
| 57 |
+ |
} |
| 58 |
+ |
|
| 59 |
+ |
private BasicAuthenticationManager getAuthManager(String username, |
| 60 |
+ |
String password) { |
| 61 |
+ |
BasicAuthenticationManager auth = new BasicAuthenticationManager( |
| 62 |
+ |
username, password); |
| 63 |
+ |
setProxy(auth); |
| 64 |
+ |
return auth; |
| 65 |
+ |
} |
| 66 |
|
|
| 67 |
< |
svnCManager = SVNClientManager.newInstance(SVNWCUtil |
| 68 |
< |
.createDefaultOptions(true)); |
| 67 |
> |
/** |
| 68 |
> |
* Constructor |
| 69 |
> |
*/ |
| 70 |
> |
public SVN() { |
| 71 |
> |
setup(); |
| 72 |
> |
|
| 73 |
> |
svnCManager = SVNClientManager.newInstance( |
| 74 |
> |
SVNWCUtil.createDefaultOptions(true), getAuthManager()); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
/** |
| 83 |
|
* Password |
| 84 |
|
*/ |
| 85 |
|
public SVN(String username, String password) { |
| 86 |
< |
// For using over http:// and https:// |
| 57 |
< |
DAVRepositoryFactory.setup(); |
| 58 |
< |
// For using over svn:// and svn+xxx:// |
| 59 |
< |
SVNRepositoryFactoryImpl.setup(); |
| 60 |
< |
// For using over file:/// |
| 61 |
< |
FSRepositoryFactory.setup(); |
| 86 |
> |
setup(); |
| 87 |
|
|
| 88 |
|
svnCManager = SVNClientManager.newInstance( |
| 89 |
< |
SVNWCUtil.createDefaultOptions(true), username, password); |
| 89 |
> |
SVNWCUtil.createDefaultOptions(true), |
| 90 |
> |
getAuthManager(username, password)); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
/** |